-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I import my own certificates? #392
Comments
Hi @eyanez111 In your example config above you are saying that the cert is at /etc/ca.crt, so you would mount the secret as a volume at /etc/ca.crt. Take a look at this example, the person who needed the cert was using it to connect to Elasticsearch, but it does not matter. Just create the secret, create the volume mount, and create the volume. I have not added a cert to Heartbeat this way, but I have done this for other software. |
Thanks for the answer. I really appreciate it.
I assume then that based on the link you shared if I already have the cert on an existing secret that the website uses all what I have to do is:
or I do not need the part: Thanks again |
I think you have it mostly correct, just change this piece:
to
If it does not work, then have a look at the logs and shell into the container and have a look at the file mounted at |
There is also an example that I wrote years ago that shows how to create a configmap that contains the cert and mount it. The cert in the example is the cert to connect to Elasticsearch, so that is not what you want (I think in your use case you want to give Heartbeat a cert to connect to a service that you are managing, correct?), but the technique is the same. |
Hello @DanRoscigno,
|
the name of the file that you want is subPath (ca.crt). I find it confusing too. |
thanks for answering so fast. So it should be like: volumeMounts:
|
three steps:
|
One question. I do have the secret but is in a different namespace do I have to copy that secret and put it on the same namespace that I am running it? I think that is the main thing why it is failing. as per what you said then I think is like this right
Thanks a lot for all the help |
My pleasure! The secret definitely needs to be in the same namespace unless your pod is running with admin level. kubectl describe pod and kubectl exec -it demo-pod -- /bin/sh will help you debug it. Open a shell into the pod and look at /etc/ca.crt to see if it contains the right thing, and describe will tell you about the secret and volume. |
ah sorry I just talked to DEV and looks like we do not have a hold of the cert. We only have the tls.cert. So there is not a CA involved. On the secret I just have the tls.cert and the tls.key. Is it possible to do it like that:
again deeply thank you as not even Elastic support has been able to point me the right direction. |
I would get it working without k8s first, then work on k8s. |
sorry but I just have a k8s environment. |
ah, I was able to get the ca after talking to devs and IT. So I was ready to proceed but after:
This is what I get: so not sure why is not recognizing the secretName... any idea? I think I am very very close! |
I don't think |
I found the error. I was adding what type of secret and secret is just to define that it is a secret what is trying to mount. so I just left it as Secret that worked. I see now the cert in the pod. I think I am quite close.... thanks again for all the help without your assistance I would not have been able to do this. |
my pleasure, once you get it all working can you pop the manifest in here for the next person? |
for sure, I am still working on it but at least I see the mount and the cert there. So definitely heading the right direction |
I have not been able to make it work with the tls but I think this means it will only work with the ca.crt and not with the tls.crt. Still the process what you described @DanRoscigno it was pretty much this:
That is how you add a secret based on a CA to heartbeat thanks again @DanRoscigno |
Hello Community,
https://www.elastic.co/guide/en/beats/heartbeat/7.16/monitor-http-options.html#monitor-http-tls-ssl
id: my-http-service
name: My HTTP Service
hosts: ["https://myhost:443"]
schedule: '@every 5s'
ssl:
certificate_authorities: ['/etc/ca.crt']
supported_protocols: ["TLSv1.0", "TLSv1.1", "TLSv1.2"]
What I do not find is how to add those certs to the pod? I have the secrets of the certs but I am not sure if I should create a secret for heatbeat? or if I should modify the existing one that I see in the kube-system:
heartbeat-token-lk8sl kubernetes.io/service-account-token 3 2d1h
if I have to create one do you have a process on how by creation it will be called by hearbeat? do I have to use any apiVersion? and if it is done by modifying the heartbeat token do I need to replace the ca.crt that I see there?
Thanks
eyanez111
The text was updated successfully, but these errors were encountered: