Last active
April 13, 2019 00:32
-
-
Save bjethwan/12c7e56c1cb2c096d6fcb282307ae324 to your computer and use it in GitHub Desktop.
Dump client k8s certificates from your kubeconf for use in remote k8s with Kubernetai CoreDNS Plugin
This file contains 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
# Dump certs (client.crt, client.key, & ca.crt) in a directory called c3certs | |
export KUBECONFIG_PATH=/home/ec2-user/.kube/config | |
sudo cat $KUBECONFIG_PATH | grep client-certificate-data | cut -f2 -d : | tr -d ' ' | base64 -d > c3certs/client.crt | |
sudo cat $KUBECONFIG_PATH | grep client-key-data | cut -f2 -d : | tr -d ' ' | base64 -d > c3certs/client.key | |
sudo cat $KUBECONFIG_PATH | grep certificate-authority-data | cut -f2 -d : | tr -d ' ' | base64 -d > c3certs/ca.crt | |
# Load the above certificates as ConfigMap in Kubernetes running with CoreNS Kubernetai plugin | |
kubectl -n kube-system create cm c3certs --from-file=/home/ec2-user/c3certs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment