칼리코 설치

알파로그·2023년 7월 4일
0

Kubernetes

목록 보기
6/15

✏️ 칼리코

  • 칼리코는 CNI 의 구현체중 하나이다.
    • CNI 는 Container Network Interface 의 약자로 Master Node 와 Worker Node 를 같은 네트워크로 묶어주는 방식을 뜻한다.
    • kubernetes 에도 기본적으로 CNI 가 설치되어있긴 하지만 성능이 좋지 않아 다른 구현체를 사용하는 것이 편하다.

📍 칼리코 설치

  • 아래 명령어로 칼리코를 설치할 수 있다.
    • master 서버에만 설치해주면된다.
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.24.1/manifests/tigera-operator.yaml

📍 환경설정

  • 환경설정을 하기 위해서 설정파일을 추가한다.
mkdir /kube && cd /kube

vim calico-resources.yaml
  • 아래 내용을 설정파일에 입력해준다.
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
  name: default
spec:
  calicoNetwork:
    bgp: Disabled
    ipPools:
    - blockSize: 26
      cidr: 10.10.0.0/16
      natOutgoing: Enabled
      encapsulation: VXLAN

---

apiVersion: operator.tigera.io/v1
kind: APIServer 
metadata: 
  name: default 
spec: {}

📍 pod 생성

  • 추가해준 환경설정 파일을 기준으로 pod 를 생성시키는 명령어이다.
kubectl create -f calico-resources.yaml

📍 containerd 다시 시작

  • 모든 server 에서 다시 시작해줘야 한다.
systemctl restart containerd

📍 확인하기

  • pod 의 상태를 확인해보면 처음과 달라진것을 확인할 수 있다.
kubectl get pods -A

NAMESPACE          NAME                                       READY   STATUS              RESTARTS   AGE
calico-apiserver   calico-apiserver-86f6645f8d-hldlg          0/1     ContainerCreating   0          2s
calico-apiserver   calico-apiserver-86f6645f8d-n7c7m          0/1     ContainerCreating   0          2s
calico-system      calico-kube-controllers-6dfbf88686-drrfl   1/1     Running             0          67s
calico-system      calico-node-wb82r                          1/1     Running             0          67s
calico-system      calico-typha-77cbf7c869-r269p              1/1     Running             0          68s
calico-system      csi-node-driver-49nln                      0/2     ContainerCreating   0          29s
kube-system        coredns-5d78c9869d-qwc65                   1/1     Running             0          95m
kube-system        coredns-5d78c9869d-t7rfv                   1/1     Running             0          95m
kube-system        etcd-master                                1/1     Running             3          95m
kube-system        kube-apiserver-master                      1/1     Running             3          95m
kube-system        kube-controller-manager-master             1/1     Running             3          95m
kube-system        kube-proxy-9q59n                           1/1     Running             0          95m
kube-system        kube-scheduler-master                      1/1     Running             3          95m
tigera-operator    tigera-operator-7bf7458-7vdnn              1/1     Running             0          78s
  • 맨 앞에 watch 를 붙이면 실시간 상황을 확인할 수 있다.
    • 하나씩 running 이 완료되면서 조금 기다리면 모든 pod 들이 running 으로 바뀐다.
watch kubectl get pods -n calico-system
  • 모든 pod 가 running 으로 바뀌면 성공이다.
    • 다시 node 를 확인해보면 ready 로 상태가 바뀐것을 확인할 수 있다.
kubectl get nodes

NAME     STATUS   ROLES           AGE   VERSION
master   Ready    control-plane   99m   v1.27.3
profile
잘못된 내용 PR 환영

0개의 댓글