Created
January 31, 2021 16:42
-
-
Save wheelq/4bb986cd38db358452e32b3fd9ffe29a to your computer and use it in GitHub Desktop.
Kubernetes- Export certificate info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Export CA | |
kubectl config view --minify --raw --output 'jsonpath={..cluster.certificate-authority-data}' | base64 -D > ca.crt | |
# Export Client Cert | |
kubectl config view --minify --raw --output 'jsonpath={..user.client-certificate-data}' | base64 -D > client.crt | |
# Export Client Key | |
kubectl config view --minify --raw --output 'jsonpath={..user.client-key-data}' | base64 -D >client.key | |
# Usage: | |
curl -k --cert client.crt --key client.key --cacert ca.crt https://[K8S_HOST]:6443/api/v1/pod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment