可以參考官方提供的比較
Clone Kubespray
1
| git clone https://github.com/kubernetes-sigs/kubespray.git
|
you can checkout by tag name
or checkout release
branch
1
| git checkout release-2.14
|
Install dependencies
1
| sudo pip3 install -r requirements.txt
|
Building your own inventory
1 2 3 4 5 6 7 8 9 10
| CLUSTER_NAME=mycluster
cp -rfp inventory/sample inventory/${CLUSTER_NAME}
declare -a IPS=(10.10.1.3 10.10.1.4 10.10.1.5)
CONFIG_FILE=inventory/${CLUSTER_NAME}/hosts.yml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
|
你可以在 inventory/${CLUSTER_NAME}/hosts.yml
看到你的 inventory
你可以配置你的 cluster
在 inventory/${CLUSTER_NAME}/group_vars
裡,詳細內容可以參考
Starting custom deployment
1
| ansible-playbook -i inventory/${CLUSTER_NAME}/hosts.yml cluster.yml -b --private-key=~/.ssh/private_key
|
Adding nodes
- Add the new work nodes to your inventory
- Run the
ansible-playbook
command with scale.yml
1
| ansible-playbook -i inventory/${CLUSTER_NAME}/hosts.yml scale.yml -b --private-key=~/.ssh/private_key
|
Remove nodes
Use --extra-vars "node=node1,node2"
1 2 3
| ansible-playbook -i inventory/${CLUSTER_NAME}/hosts.yml remove-node.yml -b \ --extra-vars "node=node1,node2" \ --private-key=~/.ssh/private_key
|