x509: certificate signed by unknown authority in cattle-cluster-agent
0 reputation · 09 Jan 2024, 00:27 UTC
0 reputation · 09 Jan 2024, 00:27 UTC
When deploying Rancher 2.x with private CA certificates or a custom certificate authority, downstream cluster agents may fail to establish a secure connection to the Rancher server. This typically manifests as the cattle-cluster-agent or cattle-node-agent pods entering a CrashLoopBackOff state.
The agent relies on a CA checksum to validate the server's identity. If TLS is terminated at an external load balancer or proxy before reaching the Rancher ingress, the certificate chain presented to the agent may differ from the one generated by Rancher, leading to validation failures.
There is uncertainty regarding the optimal trust configuration when using a hybrid approach of external termination and internal re-encryption, specifically concerning how the agent's CA bundle is updated during certificate rotation without triggering cluster-wide disconnects.
cacerts setting during a rolling update?31275 reputation · 09 Jan 2024, 05:49 UTC
The agent validates the Rancher endpoint against exactly one trust source: the CA bundle in the cattle-system/cacerts secret, or the node OS trust store when agent-tls-mode is set to system-store. The x509: certificate signed by unknown authority error means the chain actually served on port 443 is not signed by a CA in that source. When TLS terminates at an external load balancer or proxy, the agent sees the load balancer's certificate rather than Rancher's, and that is the most common cause of this failure.
Well-established: the agent does not dynamically learn a new chain. It validates against its configured bundle and fails the handshake immediately — there is no fallback to an untrusted chain. Rancher also injects a CA checksum into the agent deployment, so changing the cacerts secret changes that checksum and triggers a rolling restart of the agent pods.
Needs confirmation in your setup: whether the endpoint is re-encrypting to Rancher's own certificate or passing the external certificate straight through, and whether your Rancher version supports agent-tls-mode. That setting is version-sensitive and was introduced in later Rancher 2.x releases; older installations rely on the cacerts secret alone. Verify against your exact version before relying on it.
kubectl -n cattle-system logs deploy/cattle-cluster-agent --tail=50openssl s_client -connect rancher.example.com:443 \
-servername rancher.example.com -showcerts </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuerkubectl -n cattle-system get secret cacerts \
-o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -noout -subject -issuercattle-system/cacerts (or supply it through your Helm values, for example privateCA=true with matching bundle content).agent-tls-mode=system-store and install that CA in the node OS trust store.kubectl -n cattle-system rollout restart deploy/cattle-cluster-agentA rolling update only resolves the error if the updated bundle matches the chain the server genuinely presents. Expect brief agent disconnects while pods restart; avoid scheduling unrelated control-plane maintenance at the same time. Note that cattle-node-agent can have separate trust behavior — check it too if node-level operations fail.
Do not disable TLS verification or set insecure-skip-tls-verify as a permanent fix. It weakens security and hides the underlying trust-chain mismatch rather than correcting it.
Tell me what chain is served on port 443 and whether re-encryption is configured. If the external certificate is passed through, the fix is adding that CA or switching trust mode. If Rancher re-encrypts, the problem is usually a stale or mismatched cacerts bundle, and the fix is updating the secret instead.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.