Short answer: the client could not chain the certificate to a root CA it trusts
x509: certificate signed by unknown authority does not mean the server certificate is broken. The client could not complete the chain server certificate → intermediate → a root CA in its own trust store, and the cause is almost always one of three:
- The server does not send its intermediate certificate — works in the browser, fails in curl or the app
- A private CA the client does not know — fails only in containers or CI
- A corporate proxy re-signs TLS traffic — fails only on the office network
Same problem, different message per runtime
- Go (
kubectl,docker,helm):x509: certificate signed by unknown authority - curl / OpenSSL:
unable to get local issuer certificate - Python:
CERTIFICATE_VERIFY_FAILED· Node.js:unable to verify the first certificate - Java:
PKIX path building failed· git:server certificate verification failed
30-second diagnosis: see the chain the server sends
openssl s_client -connect api.example.com:443 -servername api.example.com -showcerts </dev/null
Certificate chain
0 s:CN = api.example.com
i:C = US, O = Let's Encrypt, CN = R11
---
Verify return code: 21 (unable to verify the first certificate)
- Only certificate 0 plus code 21 → missing intermediate (cause 1)
- Code 20 (unable to get local issuer certificate) → the client does not know the issuing root (cause 2)
- Code 19 (self signed certificate in certificate chain) → private CA; if the issuer is your company, the proxy (cause 3)
Run the same command where it fails (the container, the CI runner) and compare. If it only works on your laptop, the problem is on the client side, not the server.
Cause 1: missing intermediate — fix the server
Browsers cache or fetch the intermediate and pass anyway; curl, Go and Java fail. That is why "the browser padlock looks fine" is a trap. Make the server send the full chain (server certificate, then the intermediate).
# nginx — fullchain.pem, not cert.pem
ssl_certificate /etc/ssl/example/fullchain.pem;
# building it by hand: server certificate first
cat server.crt intermediate.crt > fullchain.pem && nginx -t && systemctl reload nginx
On a Kubernetes Ingress, check that tls.crt in the TLS Secret holds the full chain.
Cause 2: private CA — add the root where verification happens
# Debian / Ubuntu (on Alpine, apk add ca-certificates first)
cp corp-root.crt /usr/local/share/ca-certificates/ && update-ca-certificates
# RHEL / Rocky
cp corp-root.crt /etc/pki/ca-trust/source/anchors/ && update-ca-trust
# runtimes that ignore the system store
export NODE_EXTRA_CA_CERTS=/etc/ssl/corp-root.pem # Node.js
export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt # Python requests
keytool -importcert -cacerts -alias corp-root -file corp-root.crt # Java
git config --global http.sslCAInfo /etc/ssl/corp-root.pem # git
If docker pull or image pulls on Kubernetes nodes fail, the CA goes on the node's container runtime, not in the pod.
# Docker
/etc/docker/certs.d/registry.example.com:5000/ca.crt
# containerd — /etc/containerd/certs.d/registry.example.com/hosts.toml
[host."https://registry.example.com"]
ca = "/etc/containerd/certs.d/registry.example.com/ca.crt"
Cause 3: corporate proxy TLS inspection
If the issuer (i:) in the s_client output is your company or a security product, a proxy swapped the certificate. Get the proxy's root certificate from the security team and add it the same way as in cause 2.
What not to do
curl -k, InsecureSkipVerify, verify=False and NODE_TLS_REJECT_UNAUTHORIZED=0 do not fix anything; they turn verification off. Use them only to confirm the cause, never in production settings.
The order to work in
- Where it fails, run
openssl s_client -showcertsand read the chain and the Verify return code - Only the server certificate (21) → serve the full chain
- Unknown issuer (20 or 19) → add the internal root (or the proxy root) to that client or node
- Run it again and look for
Verify return code: 0 (ok)
Quick diagnostic checklist
- Run
openssl s_client -showcertswhere it fails (container, CI runner, office laptop) - Only the server certificate in the chain plus Verify return code 21 means a missing intermediate
- For a missing intermediate, make the server send the full chain (server certificate, then intermediate)
- Codes 20 or 19 mean the client does not know the issuing root — add the internal CA root
- Node (NODE_EXTRA_CA_CERTS), Python (REQUESTS_CA_BUNDLE) and Java (keytool) keep separate stores
- If docker pull or node image pulls fail, the CA goes on the node runtime, not in the pod
- An issuer named after your company or a security product means proxy TLS inspection — add the proxy root
- Use
-kor InsecureSkipVerify only to confirm the cause, never in production settings