How to export kubeconfig file from existing cluster?
16,277
Solution 1
What kind of cluster is it? A managed(AKS,EKS or GKE etc) one, where is it deployed? Can you ssh in to master node, if yes, please
cat /etc/kubernetes/admin.conf
or cat ~/.kube/config
and copy the file, which is the kubeconfig for your cluster.
Other ways to create the kubeconfig, Run the following command
kubectl config view --minify
, it will display all the info except for the client ca certificate and client key. The location of those keys depends on how the cluster is setup.
Solution 2
You can use gcloud to generate a kubeconfig entry, given that you have at least clusterViewer IAM role:
gcloud container clusters get-credentials cluster-name
For reference:
Comments
-
Raad Altaie almost 2 years
Is there an easy way to export kubeconfig file from existing cluster so i can use it in CI/CD ?