New to Kubernetes. How do I rename the cluster after kubeadm init. The default cluster name is kubenetes and I want to rename it to something more meaningful. Searched all around and can not find any instructions. Thanks!
Kubernetes – How to Rename a Cluster
kubernetes
Best Answer
As you can read here:
Apart from
kubeadm config view
you can usekubectl get configmaps -n kube-system kubeadm-config -o yaml
to view thisConfigMap
.You can change your kubernetes cluster name simply by editing
kubeadm-config
ConfigMap
using following command:change value of
clusterName
field e.g.:After saving changes to the file you'll see confirmation of successful edit:
Now you can view your new cluster name using
kubeadm config view
command:or this way:
From
kubectl
perspective your kubernetes cluster can be named totally differently than inkubeadm-config
ConfigMap
. They are configured independently. Actually in.kube/config
file you can refer to your cluster by any name you want, but you need to make the change both inclusters
as well as incontexts
sections. Look at the example below:You may also want to change your context name to reflect the current cluster name, but you don't have to. You can do it just for the sake of consistency: