线上
curl -s https://gitee.com/hewei8520/File/raw/master/1.13.5/lvm.sh |bash mkdir -p /data/kubelet ln -s /data/kubelet /var/lib/kubelet systemctl stop docker mv /var/lib/docker /data/ ln -s /data/docker /var/lib/docker systemctl restart docker # 除了将masterIP解析到hosts还包括本机地址何VIP地址 curl -s https://gitee.com/hewei8520/File/raw/master/1.13.5/base-env-config-multi-node.sh |bash # 可选参数 --experimental-control-plane 新增master节点,需提前将pki目录scp至本机 kubeadm join 172.16.100.254:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:6db027f8c7f8aaa23e1dac2c0f4a274d9364a3e253c3e762aed563ca3ae90dfb systemctl stop kubelet systemctl stop docker sed -i 's/var\/lib/data/g' /lib/systemd/system/kubelet.service.d/10-kubeadm.conf sed -i 's/Environment="KUBELET_KUBECONFIG_ARGS=/Environment="KUBELET_KUBECONFIG_ARGS=--root-dir=\/data\/kubelet /g' /lib/systemd/system/kubelet.service.d/10-kubeadm.conf systemctl enable --now docker systemctl enable --now kubelet
如果新机器是裸机,需要提前执行该命令
curl -s https://gitee.com/hewei8520/File/raw/master/1.13.5/systemd.sh |bash
本地:方法1
curl -s https://gitee.com/hewei8520/File/raw/master/1.13.5/systemd.sh |bash mkdir -p /data/kubelet ln -s /data/kubelet /var/lib/kubelet systemctl stop docker mv /var/lib/docker /data/ ln -s /data/docker /var/lib/docker systemctl restart docker # 除了将masterIP解析到hosts还包括本机地址何VIP地址 curl -s https://gitee.com/hewei8520/File/raw/master/1.13.5/base-env-config-multi-node.sh |bash # 可选参数 --experimental-control-plane 新增master节点 kubeadm join k8s-master-vip-01:8443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:40e0333e659dbe4b386ca1dde5cf11f1f08908f6a06ca30f11076037c3480610 systemctl stop kubelet systemctl stop docker sed -i 's/var\/lib/data/g' /lib/systemd/system/kubelet.service.d/10-kubeadm.conf sed -i 's/Environment="KUBELET_KUBECONFIG_ARGS=/Environment="KUBELET_KUBECONFIG_ARGS=--root-dir=\/data\/kubelet /g' /lib/systemd/system/kubelet.service.d/10-kubeadm.conf systemctl enable --now docker systemctl enable --now kubelet
方法2:已提前做好镜像
mkdir -p /data/kubelet ln -s /data/kubelet /var/lib/kubelet systemctl stop docker mv /var/lib/docker /data/ ln -s /data/docker /var/lib/docker systemctl restart docker # 除了将masterIP解析到hosts还包括本机地址何VIP地址 curl -s https://gitee.com/hewei8520/File/raw/master/1.13.5/base-local-env-config-multi-node.sh |bash # 可选参数 --experimental-control-plane 新增master节点 kubeadm join k8s-master-vip-01:8443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:40e0333e659dbe4b386ca1dde5cf11f1f08908f6a06ca30f11076037c3480610 systemctl stop kubelet systemctl stop docker sed -i 's/var\/lib/data/g' /lib/systemd/system/kubelet.service.d/10-kubeadm.conf sed -i 's/Environment="KUBELET_KUBECONFIG_ARGS=/Environment="KUBELET_KUBECONFIG_ARGS=--root-dir=\/data\/kubelet /g' /lib/systemd/system/kubelet.service.d/10-kubeadm.conf systemctl enable --now docker systemctl enable --now kubelet