Repository navigation
Description
In my current understanding, to get the Operator to work with strict TLS verification, one needs to do the following:
- Have a valid certificate issued with a CA, key and a certificate.
- Add the file openssl.xml to the "files" configuration in the CHI (provided below)
<clickhouse>
<openSSL>
<server>
<certificateFile>/etc/clickhouse-server/certs/tls.crt</certificateFile>
<privateKeyFile>/etc/clickhouse-server/certs/tls.key</privateKeyFile>
<verificationMode>strict</verificationMode>
<caConfig>/etc/clickhouse-server/certs/ca.crt</caConfig>
<loadDefaultCAFile>true</loadDefaultCAFile>
<cacheSessions>true</cacheSessions>
<disableProtocols>sslv2,sslv3</disableProtocols>
<preferServerCiphers>true</preferServerCiphers>
</server>
<client>
<loadDefaultCAFile>true</loadDefaultCAFile>
<cacheSessions>true</cacheSessions>
<disableProtocols>sslv2,sslv3</disableProtocols>
<preferServerCiphers>true</preferServerCiphers>
<verificationMode>strict</verificationMode>
<caConfig>/etc/clickhouse-server/certs/ca.crt</caConfig>
</client>
</openSSL>
</clickhouse>Those certs can be mounted by a secret using the podTemplate or by specifying it like described here: https://altinity.com/blog/clickhouse-confidential-using-kubernetes-secrets-with-the-altinity-operator "Using Secrets to transmit X509 certificates and private keys".
- Add the rootCA in the operator
config.yamlatclickhouse.access.rootCA, in my understanding to verify the certificate provided by the server against the CA. The issue is that thisclickhouse.access.rootCAseems to only accept a certificate as string, and in our case it's generated by cert-manager. So we would have to either copy paste the generated certificates into theconfig.yamlas a string - which is not nice as it might expire and this would force us to do this manual thing again.
For reference, it works when I don't set it at all but then I suppose it's not being verified.
A possible solution could be to add a property access.rootCAFile or similar, that would instead look for a certificate file on the disk. That would allow us to mount the dynamically generated CA as a secret.
Specifically I've looked at this part of the code: https://github.com/Altinity/clickhouse-operator/blob/master/pkg/model/clickhouse/connection.go#L124
And this old issue: #1073, which doesn't seem to fully answer the access.rootCA property in the operator config.yaml, and rather focuses on how to mount certificates in a CHI rather than for the operator itself.
I'm happy to provide a MR contribution if the issue is acknowledged 👍
Environment:
Chart 0.25.6
Kubernetes 1.33.7 (EKS)
Activity
sunsingerus commentedon Feb 18, 2026
Thanks for the detailed write-up and for offering to contribute.
The request is valid and the code confirms the gap exactly as you described.
clickhouse.access.rootCAis a plain string field with no file-path alternative today.What already exists as a pattern
The operator already does something similar for credentials:
clickhouse.access.secretlets you reference a k8s Secret by namespace/name, andfetchSecretCredentials()reads it at startup and populates the runtime username/password. The same pattern can be applied for the CA cert.Two approaches worth considering
Option A —
rootCAFile(simplest)Add a
rootCAFilestring field alongside the existingrootCA. At startup, read the file and feed its content into the existingsetupTLSAdvanced()pipeline, which already handles PEM, base64, and DER. Works with any mounted file — Secrets, ConfigMaps, hostPath. Implementation is minimal: a new field in the config struct and a file-read before the existing cert parsing logic.Option B — Secret reference (more Kubernetes-native)
Add a
rootCASecretstruct withnamespace,name, andkeyfields (similar to the existingaccess.secret). The operator fetches the cert directly from the k8s API at startup — no volume mount on the operator pod required. For cert-manager specifically this is the cleanest fit, since cert-manager already writes the CA to a Secret under theca.crtkey.Both approaches are acceptable. Option A is easier to implement; Option B avoids the need to mount anything extra into the operator pod.
A separate bug to fix at the same time
There is an existing
TODOinsetupTLSAdvanced()(connection.go:167) that you should be aware of:InsecureSkipVerify: trueis set unconditionally even when arootCAis configured. This means TLS server certificate verification is currently always skipped, regardless of what you put inrootCA. Your observation that "it works when I don't set it at all" is consistent with this — the behavior is identical either way today.Any PR adding
rootCAFileorrootCASecretsupport should also fix thisTODO: setInsecureSkipVerify: false(or make it a separate configurable field) when a CA is provided, so the cert pool actually gets used.Summary of what a PR should include
rootCAFileand/orrootCASecret { namespace, name, key }setupTLSAdvanced()alongside the existingrootCAstringInsecureSkipVerify: true→falsewhen a root CA is configuredHappy to review a PR when ready.
Laraakaa commentedon Feb 19, 2026
Perfect, I feel like option B) makes it easier to use overall (no manual mount when deploying) and as you say more kubernetes-native. I will likely give that a shot.
As for your other points, I saw that and already intended to add that at the same time. Happy to submit the PR when I get around it, thanks for your insightful response!
alex-zaitsev commentedon Apr 29, 2026
Planned for 0.28
alex-zaitsev commentedon Jul 20, 2026
Fixed in 0.27.2.