Arthur
Arthur

Reputation: 705

How to copy all certificates from Kubernetes on one server to Kubernetes on another one?

How to copy all certificates from Kubernetes on one server to Kubernetes on another one?

How to export them?

Possible import step

kubectl create secret tls {{ .Release.Name }}-ingress-tls-secret  --key /tmp/tls.key --cert /tmp/tls.crt [--namespace namespace]

Which actions should be after import step?

I want to see same certs on another server.

Upvotes: 0

Views: 5519

Answers (1)

Harsh Manvar
Harsh Manvar

Reputation: 30113

kubernetes store the certificate in the secret.

you can simply export the secret and import it on to new kubernetes cluster.

here is one example to export the secret locally

kubectl get secret my-secret-name(secret name) --export -o yaml > my-secret-name.yaml

my-secret-name.yaml file will be created

now on the new cluster, you can simply import the certificate using generated yaml file

kubectl apply -f my-secret-name.yaml -n namespace-name

(if want to set in a specific namespace)

after importing the certificate you can simply use them in ingress.

Upvotes: 1

Related Questions