여기서 잠시 서버 구성을 다시 확인하자
sudo kubeadm init \
--apiserver-advertise-address=[master node ip] \
--pod-network-cidr=[네트워크 환경에 따라] \
--kubernetes-version=v1.22.6
>>>
...
...
...
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.0.2:6443 –token tf9afj.p3hglea5pdk4v13m \
–discovery-token-ca-cert-hash sha256:e46f607087a9daf7d30b9afd0ff4f5ec7c4eb41f49ca2f5ba271eb0113123 \
–experimental-control-plane –certificate-key f4fdb1c3d25baa05eef7c5cd92f49e0d01425679da7871b760ddee33eaa123
kubeadm join 192.168.0.2:6443 –token tf9afj.p3hglea5pdk4v13m ...
이 명령어를 사용해 워커 노드를 join 시킬수 있다.
나중에 토큰 확인하기엔 귀찮으니 복사해 두자
Master Node에서 작업이 끝나면 worker node로 이동해 앞에서 복사한 명령어를 실행해 주자
sudo kubeadm join 192.168.0.2:6443 –token tf9afj.p3hglea5pdk4v13m \
–discovery-token-ca-cert-hash sha256:e46f607087a9daf7d30b9afd0ff4f5ec7c4eb41f49ca2f5ba271eb0113123 \
–experimental-control-plane –certificate-key f4fdb1c3d25baa05eef7c5cd92f49e0d01425679da7871b760ddee33eaa123 --v=10
>>>
...
...
...
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
성공적으로 worker node join에 성공하면 master node로 돌아와 연결을 확인한다.
# calico 파일을 다운로드
curl https://projectcalico.docs.tigera.io/manifests/calico-typha.yaml -o calico.yaml
kubectl apply -f calico.yaml
kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-958545d87-r9mhv 1/1 Running 2 (6m13s ago) 6m33s
kube-system calico-node-dk685 1/1 Running 0 6m33s
kube-system calico-node-f8jjp 1/1 Running 0 6m33s
kube-system calico-node-q74nv 0/1 Running 0 6m33s
kube-system calico-typha-855b54868c-wf7ql 1/1 Running 0 6m33s
kube-system coredns-78fcd69978-fc9w2 1/1 Running 0 35m
kube-system coredns-78fcd69978-pgfl9 1/1 Running 0 35m
kube-system etcd-gendou 1/1 Running 6 35m
kube-system kube-apiserver-gendou 1/1 Running 6 35m
kube-system kube-controller-manager-gendou 1/1 Running 0 35m
kube-system kube-proxy-5fzks 1/1 Running 0 35m
kube-system kube-proxy-7h2sj 1/1 Running 1 33m
kube-system kube-proxy-8xh25 1/1 Running 0 34m
kube-system kube-scheduler-gendou 1/1 Running 6 35m
모든 pod 들이 Running 상태로 돌아가는 것을 확인
kubectl get nodes
>>> NAME STATUS ROLES AGE VERSION
gendou Ready control-plane,master 19m v1.22.6
rei Ready <none> 18m v1.22.6
shinji Ready <none> 18m v1.22.6
정상적으로 gendou, rei, shinji 3개의 노드가 연결된 것을 확인할 수 있다.