전편(http://bryan.wiki/281)에 이어서, 이번에는 기존 k8s 클러스터에 새로운 워커 노드를 추가하는 방법에 대해 알아 보자. 클러스터의 환경 구성은 전편과 동일하다.
새로운(3 번째) 노드의 준비
* Minion 3: CPU 1, Memory 1.2GB, IP 10.255.10.183
기존 노드와 동일/유사 스펙과 설정으로 구성해 나간다
추가 Minion 노드 시간동기화 설정
[root@kubenode3 ~]# yum -y install --enablerepo=virt7-docker-common-release kubernetes etcd flannel wget git
[root@kubenode3 ~]# yum update -y
[root@kubenode3 ~]# vi /etc/chrony.conf
...
server 10.255.10.180 iburst
local stratum 10
...
[root@kubenode3 ~]# systemctl enable chronyd
[root@kubenode3 ~]# systemctl start chronyd
[root@kubenode3 ~]# chronyc tracking
Reference ID : 10.255.10.180 (10.255.10.180)
Stratum : 4
Ref time (UTC) : Sun Aug 13 10:03:29 2017
System time : 0.000000011 seconds fast of NTP time
Last offset : -0.000016258 seconds
RMS offset : 0.001879302 seconds
Frequency : 27.832 ppm fast
Residual freq : -0.014 ppm
Skew : 0.427 ppm
Root delay : 0.009792 seconds
Root dispersion : 0.045111 seconds
Update interval : 64.6 seconds
Leap status : Normal
[root@kubenode3 ~]# chronyc sources -v
210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 10.255.10.180 3 6 377 17 +23us[ +47us] +/- 51ms
추가 Minion 노드 kubernetes config/kubelet/flannel 설정
기존 노드로부터 설정파일 등을 복사하여 수정/반영한다
[root@kubenode3 ~]# mkdir k8s-files
[root@kubenode3 ~]# cd k8s-files/
[root@kubenode3k8s-files]# scp root@10.255.10.181:/etc/yum.repos.d/virt7-docker-common-release.repo /etc/yum.repos.d/
[root@kubenode3 k8s-files]# scp root@10.255.10.181:/etc/kubernetes/config /etc/kubernetes/config
[root@kubenode3 k8s-files]# scp root@10.255.10.181:/etc/kubernetes/kubelet .
[root@kubenode3 k8s-files]# vi kubelet
...
KUBELET_HOSTNAME="--hostname-override=10.255.10.183"
...
[root@kubenode3 k8s-files]# cp kubelet /etc/kubernetes/kubelet
[root@kubenode3 k8s-files]# scp root@10.255.10.181:/etc/sysconfig/flanneld /etc/sysconfig/flanneld
[root@kubenode3 k8s-files]# cd ~
[root@kubemaster ~]# scp root@10.255.10.181:~/kube-*.sh .
[root@kubemaster ~]# systemctl disable firewalld
[root@kubemaster ~]# systemctl stop firewalld
Kubernetes Master controller manager 설정
[root@kubemaster ~]# vi /etc/kubernetes/controller-manager
...
KUBELET_ADDRESSES="--machines=10.255.10.181, 10.255.10.182, 10.255.10.183"
...
[root@kubemaster ~]# systemctl restart kube-controller-manager
[root@kubemaster ~]# systemctl status kube-controller-manager
● kube-controller-manager.service - Kubernetes Controller Manager
Loaded: loaded (/usr/lib/systemd/system/kube-controller-manager.service; enabled; vendor preset: disabled)
Active: active (running) since 일 2017-08-13 16:02:14 KST; 11s ago
Docs: https://github.com/GoogleCloudPlatform/kubernetes
Main PID: 6221 (kube-controller)
Memory: 24.2M
CGroup: /system.slice/kube-controller-manager.service
└─6221 /usr/bin/kube-controller-manager --logtostderr=true --v=0 --master=http://10.255.10.18...
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: E0813 16:02:15.243100 6221 actual_state...st
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: I0813 16:02:15.265929 6221 replication_...v4
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: I0813 16:02:15.266201 6221 replication_...20
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: I0813 16:02:15.274222 6221 nodecontroll...e:
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: W0813 16:02:15.274255 6221 nodecontroll...p.
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: W0813 16:02:15.274290 6221 nodecontroll...p.
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: I0813 16:02:15.274310 6221 nodecontroll...l.
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: I0813 16:02:15.274456 6221 event.go:217] ...
8월 13 16:02:15 kubemaster kube-controller-manager[6221]: I0813 16:02:15.274478 6221 event.go:217] ...
8월 13 16:02:25 kubemaster kube-controller-manager[6221]: I0813 16:02:25.203637 6221 garbagecolle...ge
Hint: Some lines were ellipsized, use -l to show in full.
추가 Minion 노드 kubernetes 컴포넌트 시작
[root@kubenode3 ~]# for SERVICES in flanneld docker kubelet kube-proxy ; do \
> systemctl enable $SERVICES ; \
>done
Created symlink from /etc/systemd/system/multi-user.target.wants/flanneld.service to /usr/lib/systemd/system/flanneld.service.
Created symlink from /etc/systemd/system/docker.service.requires/flanneld.service to /usr/lib/systemd/system/flanneld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/kubelet.service to /usr/lib/systemd/system/kubelet.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/kube-proxy.service to /usr/lib/systemd/system/kube-proxy.service.
[root@kubenode3 ~]# ./kube-start-node.sh
--- Starting flanneld ---
Done
--- Starting docker ---
Done
--- Starting kubelet ---
Done
--- Starting kube-proxy ---
Done
[root@kubenode3 ~]# ./kube-check-node.sh
--- docker ---
active
enabled
--- flanneld ---
active
enabled
--- kubelet ---
active
enabled
--- kube-proxy ---
active
enabled
Kubernetes Master 에서 클러스터 상태 확인
[root@kubemaster ~]# kubectl get nodes
NAME STATUS AGE
10.255.10.181 Ready 9d
10.255.10.182 Ready 9d
10.255.10.183 Ready 6m
- Barracuda -
[관련 글 목록]
[Technical/Cloud, 가상화, PaaS] - [Kubernetes] CentOS 7.3 으로 Kubernetes Cluster 구성(with Flannel)-1/4
[Technical/Cloud, 가상화, PaaS] - [Kubernetes] CentOS 7.3 으로 Kubernetes Cluster 구성(노드 추가하기)-2/4
[Technical/Cloud, 가상화, PaaS] - [Kubernetes] Hyper-converged GlusterFs integration with Heketi -4/4
[Technical/Cloud, 가상화, PaaS] - [GlusterFS & Kubernetes] External Gluster PV with Heketi CLI/Rest API