ubuntu 20.04 LTS 사용
vm instance는 5개 생성
vCPU 2개, 4GB 메모리로 했는데 엄청 쾌적했다. vCPU 1~2개, 2GB 메모리로 해도 될듯?...
$ git clone https://github.com/kubernetes-sigs/kubespray.git
$ cd kubespray
$ sudo apt update
$ sudo apt install python3
$ python3 --version
Python 3.8.10
$ sudo apt install python3-pip
$ pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
$ sudo pip3 install -r requirements.txt
$ cp -rfp inventory/sample inventory/mycluster
# ## Configure 'ip' variable to bind kubernetes services on a
# ## different ip than the default iface
# ## We should set etcd_member_name for etcd cluster. The node that is not a etcd member do not need to set the value, or can set the empty string value.
[all]
instance-1 ansible_host=172.16.0.1 ip=172.16.0.1 etcd_member_name=etcd1
instance-2 ansible_host=172.16.0.2 ip=172.16.0.2
instance-3 ansible_host=172.16.0.3 ip=172.16.0.3
[kube_control_plane]
instance-1
[etcd]
instance-1
[kube_node]
instance-2
instance-3
[calico_rr]
[k8s_cluster:children]
kube_control_plane
kube_node
calico_rr
$ ansible-playbook -i inventory/mycluster/inventory.ini -v --become --become-user=root cluster.yml
20분 이상 소요
~/kuberspray$ sudo -i
root@instance-1:~#
root@instance-1:~# kubectl get node