Skip to content

Instantly share code, notes, and snippets.

@joerx
Created October 25, 2018 10:53
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 joerx/5bac5f751f0c6ac3b41bcff256e578e4 to your computer and use it in GitHub Desktop.
Save joerx/5bac5f751f0c6ac3b41bcff256e578e4 to your computer and use it in GitHub Desktop.
inspect kubeconfig client cert
#!/bin/sh
# Kubeconfig contains client keys and certs in base64 encoded form. The command below will decode the cert and show the plaintext output
# Note: 'yq' is a yaml wrapper around the awesome 'jq' - https://yq.readthedocs.io/en/latest/
# If anybody has an idea how to get kubeconfig output _including_ certs in json, let me know
cat ~/.kube/config | yq -r '.users[] | select(.name == "ap-southeast-1b.staging.kube.honestbee.com").user["client-certificate-data"]' | base64 -D | openssl x509 -text -noout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment