Skip to content

Instantly share code, notes, and snippets.

@longtian
Last active March 1, 2023 07:53
Show Gist options
  • Save longtian/c0dc4d31a4b50364e20e3e3a345d58b4 to your computer and use it in GitHub Desktop.
Save longtian/c0dc4d31a4b50364e20e3e3a345d58b4 to your computer and use it in GitHub Desktop.
kubernetes 导出 pkcs12 证书的脚本
CONFIG="/root/.kube/config"
echo -n $(cat $CONFIG | grep certificate-authority-data | cut -d: -f2) | base64 -d > my-ca-cert.crt
echo -n $(cat $CONFIG | grep client-certificate-data | cut -d: -f2) | base64 -d > my-client.crt
echo -n $(cat $CONFIG | grep client-key-data | cut -d: -f2) | base64 -d > my-client.key
openssl pkcs12 -export -out k8s.pfx -inkey my-client.key -in my-client.crt -certfile my-ca-cert.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment