Getting the expiration date of a TLS certificate inside of Kubernetes.

I had a use case to pull the expiration date from a TLS certificate from inside of Kubernetes.

The below command will output the expiration date of the certificate. Replace NAMESPACE and CERTNAME with the correct values.



kubectl -n NAMESPACE get secret CERTNAME -o "jsonpath={.data['tls\.crt]}" | base64 -D | openssl x509 -enddate -noout





Happy Hacking!