Killer Shell CKA - Cluster Setup

Jmnote (토론 | 기여)님의 2025년 10월 28일 (화) 20:07 판 (새 문서: ==개요== ;Killer Shell CKA - Cluster Setup * https://killercoda.com/killer-shell-cka/scenario/cluster-setup * 두 대의 VM(controlplane, node-summer)로 kubeadm 기반 2노드...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

Killer Shell CKA - Cluster Setup
  • https://killercoda.com/killer-shell-cka/scenario/cluster-setup
  • 두 대의 VM(controlplane, node-summer)로 kubeadm 기반 2노드 쿠버네티스 클러스터를 구성하는 실습
  • 요구 버전/옵션
    • Kubernetes 버전: v1.33.3
    • Pod CIDR: 192.168.0.0/16
    • preflight 오류 무시: NumCPU, Mem
    • /etc/kubernetes/admin.conf 를 /root/.kube/config 로 복사

2 사전 조건

  • kubeadm, kubelet, kubectl은 이미 설치됨
  • controlplane 노드에서 작업 수행
  • swap 비활성화, iptables 브릿지 설정 등은 기본적으로 되어 있다고 가정

3 컨트롤 플레인 초기화

kubeadm init 실행

controlplane:~$ kubeadm init \
  --kubernetes-version=1.33.3 \
  --pod-network-cidr=192.168.0.0/16 \
  --ignore-preflight-errors=NumCPU \
  --ignore-preflight-errors=Mem
[init] Using Kubernetes version: v1.33.3
[preflight] Running pre-flight checks
...
Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 172.30.1.2:6443 --token 35pn0k.euyvccwqd04v95s3 \
        --discovery-token-ca-cert-hash sha256:c0b189ca296952d4cd9c1be343c439f6d8360f4f656c7e9642a9ad4fe0ffba4b
출력에 kubeadm join 명령이 표시되며, 나중에 node를 조인할 때 사용한다.

관리자 kubeconfig를 설정한다.

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

kubectl이 동작하는지 확인한다.

controlplane:~$ kubectl version
Client Version: v1.33.2
Kustomize Version: v5.6.0
Server Version: v1.33.3

controlplane:~$ kubectl get nodes
NAME           STATUS   ROLES           AGE   VERSION
controlplane   Ready    control-plane   33s   v1.33.2

시스템 파드 확인

controlplane:~$ kubectl get pods -A
NAMESPACE     NAME                                   READY   STATUS              RESTARTS   AGE
kube-system   coredns-674b8bbfcf-bxxbv               0/1     ContainerCreating   0          34s
kube-system   coredns-674b8bbfcf-gsq6k               0/1     ContainerCreating   0          34s
kube-system   etcd-controlplane                      1/1     Running             0          40s
kube-system   kube-apiserver-controlplane            1/1     Running             0          40s
kube-system   kube-controller-manager-controlplane   1/1     Running             0          40s
kube-system   kube-proxy-n24w9                       1/1     Running             0          34s
kube-system   kube-scheduler-controlplane            1/1     Running             0          40s

참고: CNI 적용 전에는 CoreDNS가 ContainerCreating일 수 있다.

4 2) 노드 조인(node-summer)

node-summer 에 접속하여 출력된 조인 커맨드를 실행한다.

controlplane:~# ssh node-summer
Last login: Mon Feb 10 22:06:42 2025 from 10.244.0.131

node-summer:~$ kubeadm join 172.30.1.2:6443 --token 35pn0k.euyvccwqd04v95s3 \
        --discovery-token-ca-cert-hash sha256:c0b189ca296952d4cd9c1be343c439f6d8360f4f656c7e9642a9ad4fe0ffba4b 
[preflight] Running pre-flight checks
...
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

node-summer:~$ exit
logout
Connection to node-summer closed.

controlplane:~$ kubectl get nodes
NAME           STATUS   ROLES           AGE    VERSION
controlplane   Ready    control-plane   2m2s   v1.33.2
node-summer    Ready    <none>          49s    v1.33.2

5 트러블슈팅 팁

  • 조인 토큰 만료 시 재발급:
    • controlplane: kubeadm token create --print-join-command
  • 프리플라이트 오류 무시는 init 시에만 지정하면 된다:
    • --ignore-preflight-errors=NumCPU --ignore-preflight-errors=Mem
  • Kubelet 로그 확인:
    • systemd: journalctl -u kubelet -f
  • 네트워크 플러그인 미설치/오작동 시 CoreDNS가 Pending이 되므로 CNI를 확인/설치한다.

6 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}