- CKA 실습 환경 구성
Mac 환경에서 진행
- Docker 설치
Docker Desktop for Mac 설치
- kubectl 설치
brew install kubectl
- minikube 설치 - 쿠버네티스 클러스터 구성
brew install minikube
$ minikube start --driver docker
😄 Darwin 13.3.1 의 minikube v1.30.1
🆕 이제 1.26.3 버전의 쿠버네티스를 사용할 수 있습니다. 업그레이드를 원하신다면 다음과 같이 지정하세요: --kubernetes-version=v1.26.3
✨ 기존 프로필에 기반하여 docker 드라이버를 사용하는 중
👍 minikube 클러스터의 minikube 컨트롤 플레인 노드를 시작하는 중
🚜 베이스 이미지를 다운받는 중 ...
🔄 Restarting existing docker container for "minikube" ...
🐳 쿠버네티스 v1.24.3 을 Docker 20.10.17 런타임으로 설치하는 중
❌ 캐시된 이미지를 로드할 수 없습니다: loading cached images: stat /Users/khk/.minikube/cache/images/amd64/registry.k8s.io/etcd_3.5.3-0: no such file or directory
🔗 Configuring bridge CNI (Container Networking Interface) ...
🔎 Kubernetes 구성 요소를 확인...
▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
💡 After the addon is enabled, please run "minikube tunnel" and your ingress resources would be available at "127.0.0.1"
▪ Using image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1
▪ Using image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1
▪ Using image ingress-nginx/controller:v1.2.1
🔎 Verifying ingress addon...
❗ Enabling 'ingress' returned an error: running callbacks: [waiting for app.kubernetes.io/name=ingress-nginx pods: timed out waiting for the condition]
🌟 애드온 활성화 : storage-provisioner, default-storageclass
❗ /usr/local/bin/kubectl is version 1.27.1, which may have incompatibilities with Kubernetes 1.24.3.
▪ Want kubectl v1.24.3? Try 'minikube kubectl -- get pods -A'
🏄 끝났습니다! kubectl이 "minikube" 클러스터와 "default" 네임스페이스를 기본적으로 사용하도록 구성되었습니다.
- ingress 설치
$ minikube addons enable ingress
💡 ingress is an addon maintained by Kubernetes. For any concerns contact minikube on GitHub.
You can view the list of minikube maintainers at: https://github.com/kubernetes/minikube/blob/master/OWNERS
💡 After the addon is enabled, please run "minikube tunnel" and your ingress resources would be available at "127.0.0.1"
▪ Using image registry.k8s.io/ingress-nginx/controller:v1.7.0
▪ Using image registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20230312-helm-chart-4.5.2-28-g66a760794
▪ Using image registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20230312-helm-chart-4.5.2-28-g66a760794
🔎 Verifying ingress addon...
🌟 'ingress' 애드온이 활성화되었습니다
- 쿠버네티스 클러스터 노드 확인
$ minikube node list
minikube 192.168.49.2
- minikube를 통해 Worker 노드 생성
우선, 명령어를 확인해보자.
$ minikube node --help
Operations on nodes
Available Commands:
add Adds a node to the given cluster.
delete Deletes a node from a cluster.
list List nodes.
start Starts a node.
stop Stops a node in a cluster.
Usage:
minikube node [flags] [options]
Use "minikube <command> --help" for more information about a given command.
Use "minikube options" for a list of global command-line options (applies to all
commands).
$ minikube node add --help
Adds a node to the given cluster config, and starts it.
Options:
--control-plane=false:
This flag is currently unsupported.
--delete-on-failure=false:
If set, delete the current cluster if start fails and try again.
Defaults to false.
--worker=true:
If true, the added node will be marked for work. Defaults to true.
Usage:
minikube node add [flags] [options]
Use "minikube options" for a list of global command-line options (applies to all
commands).
명령어를 확인한 후, Worker 노드 만들어보자.
$ minikube node add --worker
😄 노드 m02 를 클러스터 minikube 에 추가합니다
❗ Cluster was created without any CNI, adding a node to it might cause broken networking.
👍 Starting worker node minikube-m02 in cluster minikube
🚜 베이스 이미지를 다운받는 중 ...
🤷 docker "minikube-m02" container is missing, will recreate.
🔥 Creating docker container (CPUs=2, Memory=2200MB) ...
🐳 쿠버네티스 v1.24.3 을 Docker 20.10.17 런타임으로 설치하는 중\ E0501 23:49:47.998734 19603 node.go:122] unable to delete node "m02": nodes "minikube-m02" not found
E0501 23:49:47.998754 19603 start.go:316] error removing existing worker node before rejoining cluster, will continue anyway: nodes "minikube-m02" not found
🔎 Kubernetes 구성 요소를 확인...
🏄 m02 를 minikube 에 성공적으로 추가하였습니다!
$ minikube node list
minikube 192.168.49.2
minikube-m02 192.168.49.3
성공적으로 노드가 추가된 것을 확인할 수 있다.
Master 노드 1개와 Worker 노드 3개로 클러스터를 구성하였다.
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 11d v1.24.3
minikube-m02 Ready <none> 7m34s v1.24.3
minikube-m03 Ready <none> 4m54s v1.24.3
minikube-m04 Ready <none> 4m27s v1.24.3
ROLES가 <none>으로 표시되는 것을 확인할 수 있었는데 라벨링을 해보자.
$ kubectl label node minikube-m02 node-role.kubernetes.io/worker=worker
node/minikube-m02 labeled
$ kubectl get nodes # minikube-m02의 ROLES이 변경된 것을 확인
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 11d v1.24.3
minikube-m02 Ready worker 8m v1.24.3
minikube-m03 Ready <none> 5m20s v1.24.3
minikube-m04 Ready <none> 4m53s v1.24.3
$ kubectl label node minikube-m03 node-role.kubernetes.io/worker=worker
node/minikube-m03 labeled
$ kubectl label node minikube-m04 node-role.kubernetes.io/worker=worker
node/minikube-m04 labeled
기본 쿠버네티스 클러스터 구성 완료하였다.
$ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
minikube Ready control-plane 11d v1.24.3 192.168.49.2 <none> Ubuntu 20.04.4 LTS 5.15.49-linuxkit docker://20.10.17
minikube-m02 Ready worker 15m v1.24.3 192.168.49.3 <none> Ubuntu 20.04.4 LTS 5.15.49-linuxkit docker://20.10.17
minikube-m03 Ready worker 12m v1.24.3 192.168.49.4 <none> Ubuntu 20.04.4 LTS 5.15.49-linuxkit docker://20.10.17
minikube-m04 Ready worker 12m v1.24.3 192.168.49.5 <none> Ubuntu 20.04.4 LTS 5.15.49-linuxkit docker://20.10.17
다른 노드 ssh 접속해보기
$ minikube ssh -n minikube-m02
'CKA' 카테고리의 다른 글
[CKA] Cluster Architecture, Installation & Configuration (2) (0) | 2023.05.14 |
---|---|
[CKA] Cluster Architecture, Installation & Configuration (1) (0) | 2023.05.13 |
[CKA] Troubleshooting (0) | 2023.05.13 |
[CKA] Services & Networking (2) | 2023.05.07 |
[CKA] 자격증이란? (0) | 2023.03.15 |