Kubernetes Cluster 해제하기
# sudo kubeadm reset => 클러스터 해제 명령어
Kubernetes Cluster 구성하기
1. master에서 설정
# sduo Kubeadm init --pod-network-cidr=10.244.0.0/16
토큰이 있어야지 node들에 연결할 수 있다. => 그림2의 빨간 박스부분을 따로 복사해 놓아야 함
2. CNI 설치(Master에서 설치)
# mkdir -p $HOME/.kube
# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config <= yes
# sudo chown $(id -u):$(id -g) $HOME/.kube/config
# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
3. 각 worker들에게 그림2의 빨간 박스 안의 내용을 복사하여 붙여넣기 해줍니다.
각각 worker에서 연결합니다.
4. node 연결확인해보기
# sudo kubectl get nodes
5. 기본환경 구성하기
◎ vmware15 = Linux(Ubuntu 64bit), Processors(4개), Virtualize Intel VT-x/EPT or AMD-V/RVI 체크하기
◎ 설치 = ubuntu-22.04.1-live-server-amd64.iso
◎ 컴퓨터이름 = 메모리:4G, 하드디스크:40G
◎ ssh, net-tools 설치 (master, worker 공통)
$ sudo apt update
$ sudo apt install -y net-tools
$ sudo apt install -y ssh
$ sudo -i
# passwd //root 패스워드 구성
◎ ubuntu-22.04.1 주소 변경
# cd /etc/netplan
# ls
# vi 00xxxxxxxxxx <== 아래 구성 복사후 붙이기
network:
ethernets:
ens32:
addresses:
- 192.168.1.104/24
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
routes:
- to: default
via: 192.168.1.2
version: 2
# netplan apply
6. host파일에 클러스터에 속한 컴퓨터 이름 등록하기
# vi /etc/hosts
▣ 쿠버네티스 명령어 자동 완성
# source <(kubectl completion bash)
# echo "source <(kubectl completion bash)" >> ~/.bashrc
# source <(kubeadm completion bash)
# echo "source <(kubeadm completion bash)" >> ~/.bashrc
kube-system 은 기본적으로 시스템에 필요한 것들을 pod로 구성되어있습니다.
▣ 쿠버네티스 기본 명령어
# kubectl get nodes
# kubectl get nodes -o wide
# kubectl get pods
# kubectl get pods -o wide
# kubectl get pods --all-namespaces
# kubectl get pods --namespace=kube-system
# kubectl get pods --namespace=kube-system -o wide
'가상화 > Kubernetes' 카테고리의 다른 글
[Kubernetes] kubectl (0) | 2023.05.12 |
---|---|
[Kubernetes] Cluster 전체구조 (0) | 2023.05.12 |
[Kubernetes] 쿠버네티스 (0) | 2023.05.12 |
댓글