环境说明

伸缩前:

主机名IP地址操作系统内核角色
node1192.168.100.11CentOS-7.13.10K8S-master
node2192.168.111.12CentOS-7.13.10K8S-node

伸缩后:

主机名IP地址操作系统内核角色
node1192.168.100.11CentOS-7.13.10K8S-master
node2192.168.111.12CentOS-7.13.10K8S-node
node3192.168.111.13CentOS-7.13.10K8S-node

操作步骤

配置主机文件

配置前:

[all]
node1 ansible_host=192.168.100.11 ansible_user=root ip=192.168.100.11
node2 ansible_host=192.168.100.12 ansible_user=root ip=192.168.100.12

[kube-master]
node1

[kube-node]
node2

[etcd]
node1

[k8s-cluster:children]
kube-node
kube-master

配置后:

[all]

node1 ansible_host=192.168.100.11 ansible_user=root ip=192.168.100.11
node2 ansible_host=192.168.100.12 ansible_user=root ip=192.168.100.12
node3 ansible_host=192.168.100.13 ansible_user=root ip=192.168.100.13

[kube-master]
node1

[kube-node]
node2
node3

[etcd]
node1

[k8s-cluster:children]
kube-node
kube-master

伸缩节点


$ ansible-playbook -i inventory/inventory.cfg scale.yml -b -v

参考

https://github.com/kubernetes-incubator/kubespray/blob/master/docs/getting-started.md

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐