You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
961 B
961 B
修改主节点IP地址
本文只在单master节点上测试通过
首先修改etcd和api-server的地址
OLD_IP=""
NEW_IP=""
sed -e "s/${OLD_IP}/${NEW_IP}/g" -i /etc/kubernetes/manifests/etcd.yaml
sed -e "s/${OLD_IP}/${NEW_IP}/g" -i /etc/kubernetes/manifests/kube-apiserver.yaml
生成新的conf
kubeadm init phase kubeconfig admin --apiserver-advertise-address ${NEW_IP}
生成新的证书
mv /etc/kubernetes/pki/apiserver.key /etc/kubernetes/pki/apiserver.key.bak
mv /etc/kubernetes/pki/apiserver.crt /etc/kubernetes/pki/apiserver.crt.bak
kubeadm init phase certs apiserver --apiserver-advertise-address 192.168.0.31
重启服务
由于docker已被kubernetes抛弃,这里使用的containerd,使用docker的旧版kubernetes要重启docker
systemctl restart containerd kubelet
更新kubectl的管理conf
rm -f ~/.kube/config
cp /etc/kubernetes/admin.conf ~/.kube/config