본문 바로가기
DevOps/Kubernetes

[Kubernetes] 로드밸런싱을 위해 Control-plane 증설 이후 작업

by Yoon_estar 2025. 2. 3.
728x90

개요

이전에 포스팅한 글을 참고해서 이이서 작업하시면 됩니다.

2025.01.11 - [DevOps] - [kubernetes]로드밸런싱을 위한 control-plane 증설

 

[kubernetes]로드밸런싱을 위한 control-plane 증설

개요아래와 같은 환경에서 현재 로드 밸런싱을 위하여 control-plane 2대를 증설하려고 한다. # k get noNAME STATUS ROLES AGE VERSIONkubemaster210 Ready control-plane 61d v1.28.15kubenode211 NotReady 61d v1.28.15kubenode212 Ready

www.estar987.com

 

문제 현상

# kubectl get no
E0125 13:18:53.798190 3074180 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0125 13:18:53.800194 3074180 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0125 13:18:53.801907 3074180 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0125 13:18:53.803818 3074180 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0125 13:18:53.805622 3074180 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
The connection to the server localhost:8080 was refused - did you specify the right host or port?

 

제대로 작업하는 화면

# kubectl get no
NAME            STATUS   ROLES           AGE   VERSION
gitlab212       Ready    <none>          13d   v1.28.15
jenkins211      Ready    <none>          13d   v1.28.15
kubemaster210   Ready    control-plane   74d   v1.28.15
kubemaster220   Ready    control-plane   13d   v1.28.15
kubemaster230   Ready    control-plane   13d   v1.28.15
kubenode213     Ready    worker          74d   v1.28.15
kubenode214     Ready    <none>          74d   v1.28.15

 

Control-plane 증설 후 인증서가 활성화가 되지 않아서 다른 노드들의 정보를 읽어오지 못하는 현상을 발견하였다. 이럴 때 기존 control-plane의 키 값을 가져오기 위하여 기존 설정 값을 scp 명령어로 복사해오면 된다. 

해결

방법 1

# scp -r .kube/ root@192.168.207.220:/root/
# kubectl get no
NAME            STATUS   ROLES           AGE   VERSION
gitlab212       Ready    <none>          13d   v1.28.15
jenkins211      Ready    <none>          13d   v1.28.15
kubemaster210   Ready    control-plane   74d   v1.28.15
kubemaster220   Ready    control-plane   13d   v1.28.15
kubemaster230   Ready    control-plane   13d   v1.28.15
kubenode213     Ready    worker          74d   v1.28.15
kubenode214     Ready    <none>          74d   v1.28.15

 

방법 2

  • 쿠버네티스 클러스터를 설치하면 admin 인증서가 있음 이것을 복사해서 사용하면 됨
  • 아래 실습은 일반 사용자에게 인증서를 부여하여 정보를 볼 수 있게 하는 것을 실시함
# ls /etc/kubernetes/admin.conf
/etc/kubernetes/admin.conf
# mkdir -p /home/estar987/.kube
# cp -i /etc/kubernetes/admin.conf /home/estar987/.kube/config
# chown estar987:estar987 /home/estar987/.kube/config
# chown -R estar987:estar987 /home/estar987/.kube/
# su - estar987
$ kubectl get no
NAME            STATUS   ROLES           AGE   VERSION
gitlab212       Ready    <none>          13d   v1.28.15
jenkins211      Ready    <none>          13d   v1.28.15
kubemaster210   Ready    control-plane   75d   v1.28.15
kubemaster220   Ready    control-plane   13d   v1.28.15
kubemaster230   Ready    control-plane   13d   v1.28.15
kubenode213     Ready    worker          75d   v1.28.15
kubenode214     Ready    <none>          75d   v1.28.15