-
Notifications
You must be signed in to change notification settings - Fork 992
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
Providing Patroni with a custom CA bundle #1877
Comments
Yes, seems it's possible. You should define and set a |
Thank you for the hint! It might be that I do something wrong, but I have to admit that the environment variables don't change anything. Here's a snippet from the file containing the configuration values for Helm:
As I can see, they are applied, here's what I see in the description of the 1st pod:
But at the same time, I still get the same error messages in the output of Patroni:
At the same time, By the way That's also pretty odd that the other environment variables of this pod doesn't contain the
Why does not these variables' names contain the Thanks. |
Sorry, my bad, Zalando operator don't run Partoni directly and utilizes Spilo image for it |
Alas, I will open a similar issue for Thanks! |
For this variable propagation, you should set # Custom TLS certificate. Disabled unless tls.secretName has a value.
tls:
secretName: "" # should correspond to a Kubernetes Secret resource to load
certificateFile: "tls.crt"
privateKeyFile: "tls.key"
caFile: "" # optionally configure Postgres with a CA certificate
caSecretName: "" # optionally the ca.crt can come from this secret instead``` |
Of course, I've set them and I see that the environment variables are properly set, but the point is that they don't affect interactions with Kubernetes API Server at all. They seem to be affecting interactions between Patroni instances only. :-( |
Oh, yes, true. For this case, some fixes in the Spilo should be implemented to propagate these options to the Patroni |
Is this resolved via https://github.com/zalando/spilo/releases/tag/2.1-p6 or other recent changes? |
Haven't tried that yet, because I decided that using a "long" CA bundle for a Kubernetes wasn't a good idea at all. There are way too many issues with other components. |
@khmarochos Just trying to understand the scope of "many issues with other components", do you mean also other stuff than just Zalando Postgresql? Having the exact same issue here, regarding a custom k8s CA & Kubeapi server Also, I find it a bit weird behavior. If you take a look at this documentation of Patroni Kubernetes env params:
When checking the /var/run/secrets/kubernetes.io/serviceaccount/ca.crt inside the database container, it contains the correct CA. But not the entire chain (which kinda makes sense?). So perhaps when the CA is mountable in /etc/ssl/certs/<ca.pem> it is fixed (if the app looks in that dir)? |
@D1StrX, right, a chained CA causes lots of pain. I had similar problems with the Elastic stack. I also have a feeling that there were something else, though I can't remember what exactly. So, I decided to amandon the idea to use chained CAs for Kubernetes clusters.
There is not too much of feedback, so it might be that there are not too many perverts to do that. :-) |
Hello,
Is that possible to provide Patroni with a custom CA bundle for interacting with Kubernetes API Server?
By default it uses
/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
which is set by Kuberneres (it consists the data from theSecret
referred by the mainServiceAccount
). My problem is that my Kuberneres' certificate is signed by an intermediate certificate which is signed by a self-signed root certificate. Alas, Patroni (or, to be exact, the SSL library that is being used by Patroni) couldn't establish the TLS-session with the Kubernetes API Server, because/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
consists only a "shortened" version of my CA chain (only the intermediate CA certificate is included there, the root one is omitted). That seems to be enough for Kubernetes itself, but Patroni (or the SSL library, to be exact) needs to check the full chain.Is there a way to ask Patroni to use the full version of my CA chain when it's interacting with the Kubernetes API Server? Of course, I know that that's possible to set
kubernetes.cacert
in the Patroni's configuration file (according to this manual: https://github.com/zalando/patroni/blob/master/docs/SETTINGS.rst#kubernetes) to make it using any file instead of theca.crt
provided by Kuberneres, but I can't find the way to accomplish that by Postgres Operator.Would anyone be so kind as to help me to find a way to do that?
Thanks in advance!
The text was updated successfully, but these errors were encountered: