我有一个带有3个主节点的kubernetes集群。它们分别命名为master-1,master-2和master-3。我想将它们重命名为control-plane-n。
我找不到明确的操作步骤。最接近的是如何重命名群集中的节点。所以我只是尝试了。这就是我所做的(我的主机正在运行ubuntu 18.04和kubernetes v1.16.2):
在master-1上:
在master-3上:
这是我得到的日志:
sudo kubeadm join 172.22.19.188:6443 --control-plane --token nxxzby.zsfdx86e7cv1rq0e --discovery-token-ca-cert-hash sha256:553366c2f91fd3abffe3e3d1c39d9314e2d73e8a6181f4da9938a8e24fd77456
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[preflight] Running pre-flight checks before initializing the new control plane instance
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[certs] Using certificateDir folder "/data/kubernetes/pki"
error execution phase control-plane-prepare/certs: error creating PKI assets: failed to write or validate certificate "apiserver": certificate apiserver is invalid: x509: certificate is valid for master-3, kubernetes, kubernetes.default, kubernetes.default.svc, kubernetes.default.svc.cluster.local, not control-plane-3
To see the stack trace of this error execute with --v=5 or higher
我该如何进行?还是有更好的方法?
在此先感谢您提供的任何想法或建议。
答案 0 :(得分:0)
基于@zerkms的注释,您可以创建一个具有适当名称的第4个节点,然后加入,然后从集群中删除其中一个旧节点。
这样做3次,您将能够使所有节点具有所需的名称。