Reputation: 12352
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.
Running kubernetes inside Docker for mac on MacOS Mojave:
Upvotes: 7
Views: 13658
Reputation: 316
Unfortunately, the "get secret" way is not working anymore (from the release 1.24 there aren't auto-generated secrets).
In GKE clusters, I've found this way to get the ca certificate:
kubectl get cm kube-root-ca.crt -o jsonpath="{['data']['ca\.crt']}"
Upvotes: 9
Reputation: 3832
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.
Upvotes: 9