How do I obtain Kubernetes CA Certificate?

4/1/2019

I am setting up Vault in Kubernetes and enabling the Kubernetes Auth method. It needs the Kubernetes CA Certificate. How do I obtain that? I couldn't find much on duckduckgo's search results.

enter image description here

Running kubernetes inside Docker for mac on MacOS Mojave:

enter image description here Thank you.

-- user674669
hashicorp-vault
kubernetes
x509certificate

1 Answer

4/1/2019

This can be found in your kube-system (or any other) namespace by running the following on your default-token secret:

kubectl get secret <secret name> -n <namespace> -o jsonpath="{['data']['ca\.crt']}" | base64 --decode

To find the secret name run kubectl get secret -n kube-system and find the secret that starts with default-token.

This will give you something like:

-----BEGIN CERTIFICATE-----
XXXXXXX
XXXX....
-----END CERTIFICATE-----

When you are entering this certificate, make sure to enter the BEGIN and END header and footer.

-- cookiedough
Source: StackOverflow