2023.08.27 - [인프라/Kubernetes] - Kubernetes 실습 및 서비스 구축
윈도우 wsl2 ubuntu와 docker 연동
kind 설치
root@DESKTOP-Q4VBHGG:/home/yellownyou# curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.10.0/kind-linux-amd64
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 7277k 100 7277k 0 0 433k 0 0:00:16 0:00:16 --:--:-- 417k
전역에서 사용 할 수 있도록 위치를 이동
root@DESKTOP-Q4VBHGG:/home/yellownyou# mv ./kind /usr/local/bin/
vscode를 통한 wsl 원격 접속
노드 설정 kind-node.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
클러스터 생성
root@DESKTOP-Q4VBHGG:/home/yellownyou# kind create cluster --name kubernetes --config ./kind-node.yaml
Creating cluster "kubernetes" ...
✓ Ensuring node image (kindest/node:v1.20.2) 🖼
✓ Preparing nodes 📦 📦 📦 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
✓ Joining worker nodes 🚜
Set kubectl context to "kind-kubernetes"
You can now use your cluster with:
kubectl cluster-info --context kind-kubernetes
Not sure what to do next? 😅 Check out https://kind.sigs.k8s.io/docs/user/quick-start/
노드 생성 확인
root@DESKTOP-Q4VBHGG:/home/yellownyou# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kubernetes-control-plane Ready control-plane,master 69s v1.20.2
kubernetes-worker Ready <none> 37s v1.20.2
kubernetes-worker2 Ready <none> 38s v1.20.2
kubernetes-worker3 Ready <none> 37s v1.20.2
root@DESKTOP-Q4VBHGG:/home/yellownyou# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
113552c08f93 kindest/node:v1.20.2 "/usr/local/bin/entr…" About a minute ago Up About a minute 127.0.0.1:40385->6443/tcp kubernetes-control-plane
e23dda72fb9e kindest/node:v1.20.2 "/usr/local/bin/entr…" About a minute ago Up About a minute
kubernetes-worker2
d18eb251cf54 kindest/node:v1.20.2 "/usr/local/bin/entr…" About a minute ago Up About a minute
kubernetes-worker3
2ba3c582f28a kindest/node:v1.20.2 "/usr/local/bin/entr…" About a minute ago Up About a minute
kubernetes-worker
Kubernetes 관련 파일은
https://github.com/Sihyun3/LearningKubernetes/tree/main
여기서 확인 가능합니다.
'인프라 > Kubernetes' 카테고리의 다른 글
Jenkins를 통한 Kubernetes rolling update (0) | 2023.09.03 |
---|---|
Kubernetes Pods Auto Scalling (0) | 2023.09.03 |
Kubernetes 퍼시스턴트 볼륨 (0) | 2023.08.31 |
Kubernetes 디플로이먼트 정의 및 노드 포트 서비스 연동 (0) | 2023.08.28 |
Kubernetes 실습 및 서비스 구축 (0) | 2023.08.27 |