새로운 노드를 추가하기위해서는 token과 discovery-token-ca-cert-hash가 필요합니다.
token생성
[root@k8s-master ~]# kubeadm token create
W0418 03:38:30.103931 29081 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
2mt2fr.vamluzvusmol403t
discovery-token-ca-cert-hash 값
[root@k8s-master ~]# openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
02ad4630328d720e8d9567e1ab0d8bf6d98c243bedd10b827537c189b49fc7c1
token과 discovery-token-ca-cert-hash 값을 복사해서
새로 추가할 노드에 kubeadm join 을 실행해줍니다.
kubeadm join [master ip:6443] --token [2mt2fr.vamluzvusmol403t] --discovery-token-ca-cert-hash sha256:[02ad4630328d720e8d9567e1ab0d8bf6d98c243bedd10b827537c189b49fc7c1]
ex)
[root@k8s-node03 ~]# kubeadm join 192.168.1.11:6443 --token 2mt2fr.vamluzvusmol403t --discovery-token-ca-cert-hash sha256:02ad4630328d720e8d9567e1ab0d8bf6d98c243bedd10b827537c189b49fc7c1
W0418 03:41:56.788876 30738 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.18" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
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.
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
k8s events 확인
[root@k8s-master ~]# kubectl get events
LAST SEEN TYPE REASON OBJECT MESSAGE
21m Normal Starting node/k8s-node03 Starting kubelet.
21m Normal NodeHasSufficientMemory node/k8s-node03 Node k8s-node03 status is now: NodeHasSufficientMemory
21m Normal NodeHasNoDiskPressure node/k8s-node03 Node k8s-node03 status is now: NodeHasNoDiskPressure
21m Normal NodeHasSufficientPID node/k8s-node03 Node k8s-node03 status is now: NodeHasSufficientPID
21m Normal NodeAllocatableEnforced node/k8s-node03 Updated Node Allocatable limit across pods
21m Normal RegisteredNode node/k8s-node03 Node k8s-node03 event: Registered Node k8s-node03 in Controller
20m Normal Starting node/k8s-node03 Starting kube-proxy.
20m Normal NodeReady node/k8s-node03 Node k8s-node03 status is now: NodeReady
노드 상세 확인
kubectl get node -o wide
ex)
[root@k8s-master ~]# kubectl get node -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-master Ready master 5d21h v1.18.1 192.168.1.11 <none> CentOS Linux 7 (Core) 3.10.0-1062.18.1.el7.x86_64 docker://19.3.8
k8s-node01 Ready <none> 5d21h v1.18.1 192.168.1.12 <none> CentOS Linux 7 (Core) 3.10.0-1062.18.1.el7.x86_64 docker://19.3.8
k8s-node02 Ready <none> 5d21h v1.18.1 192.168.1.13 <none> CentOS Linux 7 (Core) 3.10.0-1062.18.1.el7.x86_64 docker://19.3.8
k8s-node03 Ready <none> 5m53s v1.18.2 192.168.1.14 <none> CentOS Linux 7 (Core) 3.10.0-1062.18.1.el7.x86_64 docker://19.3.8
'Kubernetes' 카테고리의 다른 글
쿠버네티스 설치하기 (0) | 2020.04.09 |
---|---|
쿠버네티스 기초 Rolling Update (0) | 2020.04.01 |
쿠버네티스 기초 Deployment (0) | 2020.03.29 |
쿠버네티스 기초 ReplicaSet (0) | 2020.03.27 |
쿠버네티스 기초 Replication Controller (0) | 2020.03.26 |