Interview Prep/Kubernetes/Nodes, kubelet and container runtime

A node is `NotReady` and the kubelet log shows `x509: certificate has expired or is not yet valid` when talking to the API server.

IntermediateTroubleshootingNodes, kubelet and container runtime
Answer

Likely causes → The kubelet client certificate expired because rotation was disabled or failed, or the node clock is wrong (not yet valid), common after long power-off or broken NTP.

Diagnose →

# On the node
sudo openssl x509 -in /var/lib/kubelet/pki/kubelet-client-current.pem -noout -dates
timedatectl status
grep -i rotateCertificates /var/lib/kubelet/config.yaml
kubectl get csr      # pending kubelet CSRs

Fix → Fix time sync (chronyc makestep). For an expired cert on kubeadm, re-bootstrap the kubelet: create a new join token, rejoin the node, or regenerate kubelet.conf with kubeadm kubeconfig user on the control plane. Approve pending CSRs if they are legitimate: kubectl certificate approve <csr>.

Prevent → rotateCertificates: true, working NTP, and monitoring of certificate expiry on nodes.

All Kubernetes questions

More on Nodes, kubelet and container runtime