본문 바로가기

DevOps/쿠버네티스(Kubernetes)

MacOS에서 쿠버네티스 구축 (control-plane,node 설정/calico 애드온 )

control-plane 설정

  • k-control 에서 진행

# kubeadm init
$ sudo kubeadm init --control-plane-endpoint 192.168.56.10 --pod-network-cidr 192.168.56.0/21 --apiservier-advertise-address 192.168.56.10

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

# 칼리코 애드온 설치 
$ kubectl apply -f <https://docs.projectcalico.org/manifests/calico.yaml>

→ kubeadm init 오류 시 아래 트러블슈팅 참고

 

참고 문서: 

 

 

Creating a cluster with kubeadm

Using kubeadm, you can create a minimum viable Kubernetes cluster that conforms to best practices. In fact, you can use kubeadm to set up a cluster that will pass the Kubernetes Conformance tests. kubeadm also supports other cluster lifecycle functions, su

kubernetes.io

 

 

Cloud Native Application Protection Platform (CNAPP) – Tigera

The industry’s only active Cloud-Native Application Protection Platform (CNAPP) with full-stack observability for containers, Kubernetes, and cloud.

www.tigera.io

 

 


node 설정

  • k-node1, k-node2, k-node3 에서 진행

# kubeadm init 시 생성 된 토큰값 
$ sudo kubeadm join 192.168.56.10:6443 --token b5l5ug.h0rxhd29ai414egs --discovery-token-ca-cert-hash sha256:14a432a32f63fd205f58d9e025fed40bf88b1bb23543ca0601950fbc579c34c3

$ kubectl get nodes

 

 

 


참고

1. kubeadm init 오류

[init] Using Kubernetes version: v1.24.0
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
	[ERROR CRI]: container runtime is not running: output: time="2022-05-18T05:38:10Z" level=fatal msg="getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

 

해결)

$ sudo rm /etc/containerd/config.toml
$ sudo systemctl restart containerd

위와 같은 에러 발생 시 명령어 입력