Foundations of trust · wrap-up
Cheat sheet & self-check
Every command from this section on one page.
Quick checks: how much implicit trust is left?
kubectl get networkpolicy -A | Namespaces with no policy are flat: every pod can reach them |
kubectl get peerauthentication -A | Mesh mTLS mode per namespace (PERMISSIVE still accepts plaintext) |
kubectl get ns -L pod-security.kubernetes.io/enforce | Pod Security level enforced per namespace |
kubectl get clusterrolebindings -o wide | grep cluster-admin | Who holds cluster-admin |
kubectl auth can-i --list --as=system:serviceaccount:<ns>:default | What a namespace's default ServiceAccount can do |
Inspect TLS from the command line
openssl s_client -connect host:443 -servername host -tls1_3 </dev/null | Handshake details, chain and negotiated cipher |
openssl s_client -connect host:443 -showcerts </dev/null | Print every certificate the server sends |
openssl x509 -in cert.pem -noout -subject -issuer -dates -ext subjectAltName | Who, issued by whom, validity, SAN names |
curl -v --cert client.crt --key client.key --cacert ca.crt https://api.internal | Call an mTLS endpoint with a client certificate |
openssl s_server -accept 8443 -cert srv.crt -key srv.key -CAfile ca.crt -Verify 1 | Test server that requires a client certificate |
Inventory and expiry
kubectl get certificates -A | cert-manager certificates and their Ready state |
kubectl get certificaterequests -A --sort-by=.metadata.creationTimestamp | Recent issuance attempts (look for failures) |
kubeadm certs check-expiration | Control-plane certificate expiry on a kubeadm node |
openssl x509 -in cert.pem -noout -enddate | Expiry of one certificate |
echo | openssl s_client -connect host:443 -servername host 2>/dev/null | openssl x509 -noout -enddate | Expiry as a client actually sees it |
Trust bundles
cat old-root.pem new-root.pem > bundle.pem | A bundle that trusts both roots during rotation |
openssl verify -CAfile bundle.pem -untrusted intermediate.pem leaf.pem | Check a leaf chains to a root in the bundle |