[root@master kubeasz]# cd /etc/ansible/ # 完成后,所需的文件都会下载到ansible目录下[root@master ansible]# ll
total 92
-rw-rw-r-- 1 root root 395 May 28 21:11 01.prepare.yml
-rw-rw-r-- 1 root root 58 May 28 21:11 02.etcd.yml
-rw-rw-r-- 1 root root 149 May 28 21:11 03.containerd.yml
-rw-rw-r-- 1 root root 137 May 28 21:11 03.docker.yml
-rw-rw-r-- 1 root root 470 May 28 21:11 04.kube-master.yml
-rw-rw-r-- 1 root root 140 May 28 21:11 05.kube-node.yml
-rw-rw-r-- 1 root root 408 May 28 21:11 06.network.yml
-rw-rw-r-- 1 root root 77 May 28 21:11 07.cluster-addon.yml
-rw-rw-r-- 1 root root 3686 May 28 21:11 11.harbor.yml
-rw-rw-r-- 1 root root 431 May 28 21:11 22.upgrade.yml
-rw-rw-r-- 1 root root 1975 May 28 21:11 23.backup.yml
-rw-rw-r-- 1 root root 113 May 28 21:11 24.restore.yml
-rw-rw-r-- 1 root root 1752 May 28 21:11 90.setup.yml
-rw-rw-r-- 1 root root 1127 May 28 21:11 91.start.yml
-rw-rw-r-- 1 root root 1120 May 28 21:11 92.stop.yml
-rw-rw-r-- 1 root root 337 May 28 21:11 99.clean.yml
-rw-rw-r-- 1 root root 10283 May 28 21:11 ansible.cfg
drwxrwxr-x 2 root root 4096 Sep 7 16:59 bin
drwxrwxr-x 2 root root 23 May 29 09:15 dockerfiles
drwxrwxr-x 8 root root 92 May 29 09:15 docs
drwxrwxr-x 2 root root 292 Sep 7 17:01 down
drwxrwxr-x 2 root root 52 May 29 09:15 example
drwxrwxr-x 14 root root 218 May 29 09:15 manifests
drwxrwxr-x 2 root root 322 May 29 09:15 pics
-rw-rw-r-- 1 root root 5653 May 28 21:11 README.md
drwxrwxr-x 23 root root 4096 May 29 09:15 roles
drwxrwxr-x 2 root root 294 May 29 09:15 tools
[root@master ansible]# cp example/hosts.multi-node ./hosts[root@master ansible]# vim hosts# 'etcd' cluster should have odd member(s) (1,3,5,...)# variable 'NODE_NAME' is the distinct name of a member in 'etcd' cluster[etcd]
192.168.131.145 NODE_NAME=etcd1
# master node(s)[kube-master]
192.168.131.145
# work node(s)[kube-node]
192.168.131.146
192.168.131.147
# [optional] harbor server, a private docker registry# 'NEW_INSTALL': 'yes' to install a harbor server; 'no' to integrate with existed one# 'SELF_SIGNED_CERT': 'no' you need put files of certificates named harbor.pem and harbor-key.pem in directory 'down'[harbor]#192.168.1.8 HARBOR_DOMAIN="harbor.yourdomain.com" NEW_INSTALL=no SELF_SIGNED_CERT=yes# [optional] loadbalance for accessing k8s from outside[ex-lb]#192.168.1.6 LB_ROLE=backup EX_APISERVER_VIP=192.168.1.250 EX_APISERVER_PORT=8443#192.168.1.7 LB_ROLE=master EX_APISERVER_VIP=192.168.1.250 EX_APISERVER_PORT=8443# [optional] ntp server for the cluster[chrony]
192.168.131.145
[all:vars]# --------- Main Variables ---------------# Cluster container-runtime supported: docker, containerd
CONTAINER_RUNTIME="docker"# Network plugins supported: calico, flannel, kube-router, cilium, kube-ovn
CLUSTER_NETWORK="calico"# Service proxy mode of kube-proxy: 'iptables' or 'ipvs'
PROXY_MODE="ipvs"# K8S Service CIDR, not overlap with node(host) networking
SERVICE_CIDR="10.68.0.0/16"# Cluster CIDR (Pod CIDR), not overlap with node(host) networking
CLUSTER_CIDR="172.20.0.0/16"# NodePort Range
NODE_PORT_RANGE="20000-40000"# Cluster DNS Domain
CLUSTER_DNS_DOMAIN="cluster.local."# -------- Additional Variables (don't change the default value right now) ---# Binaries Directory
bin_dir="/opt/kube/bin"# CA and other components cert/key Directory
ca_dir="/etc/kubernetes/ssl"# Deploy Directory (kubeasz workspace)
base_dir="/etc/ansible"
测试是否ping通
[root@master ansible]# ansible all -m ping
/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
from cryptography.exceptions import InvalidSignature
192.168.131.145 | SUCCESS =>{"changed": false,
"ping":"pong"}
192.168.131.147 | SUCCESS =>{"changed": false,
"ping":"pong"}
192.168.131.146 | SUCCESS =>{"changed": false,
"ping":"pong"}