1.使用 KubeKey 检索集群信息。以下命令会创建配置文件 (sample.yaml
)。
./kk create config --from-cluster
2.在配置文件中,将新节点的信息放在 hosts
和 roleGroups
之下。该示例添加了两个新节点(即 node1
和 node2
)。这里的 master1
是现有节点。
···
spec:
hosts:
- {name: master1, address: 192.168.0.3, internalAddress: 192.168.0.3, user: root, password: Qcloud@123}
- {name: node1, address: 192.168.0.4, internalAddress: 192.168.0.4, user: root, password: Qcloud@123}
- {name: node2, address: 192.168.0.5, internalAddress: 192.168.0.5, user: root, password: Qcloud@123}
roleGroups:
etcd:
- master1
control-plane:
- master1
worker:
- node1
- node2
···
3.执行以下命令:
./kk add nodes -f sample.yaml