Skip to content

Instantly share code, notes, and snippets.

@iAnatoly
Last active December 7, 2021 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iAnatoly/a99022aa28d2e93588ec610579b22666 to your computer and use it in GitHub Desktop.
Save iAnatoly/a99022aa28d2e93588ec610579b22666 to your computer and use it in GitHub Desktop.
check kube client cert validity period
cat ~/.kube/config | grep client-certificate | sed -e ‘s/ client-certificate-data: //’ | base64 -d | openssl x509 -in - -noout -text
@iAnatoly
Copy link
Author

iAnatoly commented Dec 7, 2021

Or even better, end=cat ~/.kube/config | grep client-certificate | sed -e 's/ client-certificate-data: //' | base64 -d | openssl x509 -in - -noout -enddate |cut -d "=" -f 2; echo $end; end_s=date -d "${end}" "+%s"; echo -e "\033[1m$(((${end_s}-date +%s)/(24*3600)))\033[0m days until expiration"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment