Skip to main content
In this lesson we walk through a practical solution for the lab on inspecting and troubleshooting Kubernetes TLS certificates. You’ll learn how to locate the kube-apiserver and etcd static pod manifests, identify the certificate and key files they reference, inspect certificate details (CN, issuer, SANs, validity) with openssl, and follow two real troubleshooting scenarios where kube-apiserver lost connectivity because of certificate path or CA mismatches — including diagnosis and remediation steps. Key topics: kube-apiserver TLS, etcd TLS, certificate paths, openssl inspection, kube-apiserver ↔ etcd mTLS troubleshooting, kubectl connection errors.

1) Locate the kube-apiserver manifest and certificate paths

Static pod manifests live under /etc/kubernetes/manifests. Open the kube-apiserver manifest to discover which certificate and key files the API server uses.
From this manifest you can identify the most important cert/key paths used by kube-apiserver: Note: These files typically live under /etc/kubernetes/pki and subdirectories. If any path in the manifest points to a non-existent file, the static pod will fail to start and kubelet logs (or the container logs) will show the error.

2) etcd manifest and its server/peer certificates

Open the etcd static pod manifest (for example /etc/kubernetes/manifests/etcd.yaml) to see how etcd is configured for server and peer TLS:
Important etcd files: Anything related to etcd server/peer TLS should be under /etc/kubernetes/pki/etcd. If etcd logs reference missing files, verify the directory listing with ls /etc/kubernetes/pki/etcd.

3) Inspect certificate details with openssl

Use openssl x509 to inspect certificate Subject (CN), Issuer (CA), SAN entries, and validity.
  • To inspect the kube-apiserver certificate:
Example relevant output (excerpt):
Takeaways:
  • Subject CN: kube-apiserver.
  • Issuer (signing CA): kubernetes.
  • SANs: hostnames and IPs the cert is valid for. If a client name (e.g. kube-master) is not in the SANs, TLS will not validate that name.
  • To inspect the etcd server certificate:
Example relevant excerpt:
Takeaways:
  • Subject CN: controlplane.
  • Issuer (signing CA): etcd-ca.
Common validity patterns:
  • API server certs are often short-lived (1 year in the example).
  • Root CAs (e.g. kubernetes CA) often have long lifetimes (e.g. ~10 years).
If you need to inspect certificates, use openssl x509 -in <path-to-crt> -text -noout. Always check both the Subject and Issuer fields and the SANs to ensure identity and trust chains match the configuration.

4) Troubleshooting: kubectl stops responding after a change window

Symptom:
kubectl cannot reach kube-apiserver. Since kube-apiserver runs as a static pod on the control-plane node, start by inspecting the control-plane containers and their logs. Example commands (adjust for your container runtime, e.g., crictl, ctr, docker):

4.1 Symptom: kube-apiserver logs show repeated connection errors to etcd

Example kube-apiserver log lines:
This indicates kube-apiserver cannot connect to etcd at 127.0.0.1:2379 (connection refused). Inspect etcd container logs and the etcd manifest.

4.2 Root cause example #1: etcd manifest references a nonexistent certificate file

etcd logs might include:
But the actual directory contains:
Diagnosis: The manifest references /etc/kubernetes/pki/etcd/server-certificate.crt which does not exist; the correct file is /etc/kubernetes/pki/etcd/server.crt. Fix:
  1. Edit /etc/kubernetes/manifests/etcd.yaml.
  2. Correct the --cert-file argument to /etc/kubernetes/pki/etcd/server.crt.
  3. Save the manifest — kubelet will detect the change and restart the static pod automatically.
After the fix:
  • etcd should start and bind to 127.0.0.1:2379 and 10.46.98.9:2379.
  • kube-apiserver reconnects to etcd and kubectl begins working again.

5) Troubleshooting: TLS handshake timeout / “certificate signed by unknown authority”

Another outage symptom:
Investigate kube-apiserver logs and etcd logs. etcd may show many rejected connections like:
This indicates TLS client authentication or CA trust issues — etcd is actively rejecting kube-apiserver’s client certs or kube-apiserver is rejecting etcd’s server cert.

5.1 Root cause example #2: kube-apiserver configured to trust the wrong CA for etcd

Inspect the kube-apiserver manifest and confirm the --etcd-cafile setting. An incorrect setting looks like:
Here /etc/kubernetes/pki/ca.crt may be the Kubernetes cluster CA (which issued API server certs), not the etcd CA (/etc/kubernetes/pki/etcd/ca.crt). If kube-apiserver is not using the CA that signed etcd’s server certificate, or if etcd is not trusting the CA that signed kube-apiserver’s client cert, TLS handshakes will fail. Correct configuration should look like:
Fix:
  1. Edit /etc/kubernetes/manifests/kube-apiserver.yaml.
  2. Point --etcd-cafile to the etcd CA: /etc/kubernetes/pki/etcd/ca.crt.
  3. Ensure --etcd-certfile/--etcd-keyfile refer to the apiserver-etcd client credentials.
  4. Save the manifest — kubelet will restart the kube-apiserver static pod with the new flags.

5.2 Result

  • Once --etcd-cafile is corrected and the apiserver client cert/key are valid and signed by the etcd CA (or vice versa), TLS handshakes succeed.
  • etcd stops rejecting connections and kube-apiserver resumes normal operation, restoring kubectl access.

6) Checklist and quick-reference when debugging kube-apiserver ↔ etcd TLS issues

  • Verify static pod manifests: check /etc/kubernetes/manifests/kube-apiserver.yaml and /etc/kubernetes/manifests/etcd.yaml.
  • Confirm file paths in the manifests exist on disk (ls /etc/kubernetes/pki and /etc/kubernetes/pki/etcd).
  • Ensure mutual TLS alignment:
    • etcd server certs and CA are under /etc/kubernetes/pki/etcd/ (e.g. server.crt, server.key, ca.crt).
    • kube-apiserver should use --etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt.
    • kube-apiserver should present the client cert/key set via --etcd-certfile & --etcd-keyfile.
  • Use openssl to inspect certificates: openssl x509 -in <cert> -text -noout.
  • Typical log indicators:
    • Connection refused to 127.0.0.1:2379 → etcd not listening; check etcd logs and manifest file paths.
    • TLS handshake timeout / tls: bad certificate → CA mismatch or invalid client cert; compare issuers and CA files.
  • Editing static pod manifests triggers kubelet to restart the corresponding static pod automatically.
Quick commands and examples:
When debugging TLS issues, always compare the Issuer: field from openssl x509 -in <cert> -text -noout with the CA file path configured in the other component. Mismatched CAs are a common source of TLS handshake failures.


This completes the walkthrough for viewing certificate details and troubleshooting kube-apiserver ↔ etcd TLS issues.

Watch Video