Skip to content

Instantly share code, notes, and snippets.

@wheelq
Created January 31, 2021 16:42
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 wheelq/4bb986cd38db358452e32b3fd9ffe29a to your computer and use it in GitHub Desktop.
Save wheelq/4bb986cd38db358452e32b3fd9ffe29a to your computer and use it in GitHub Desktop.
Kubernetes- Export certificate info
#!/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