본문 바로가기
Development/Docker&Kubernetes

VirtualBox 에 Kubernetes 올리기(k3s)

by 폴피드 2020. 9. 11.
728x90
반응형

https://coffeewhale.com/kubernetes/cluster/virtualbox/2020/08/31/k8s-virtualbox/

 

1. Virtual Box 설치 & 설정

총 3대의 VM. (master, worker1, worker2)

 

2. 인증서 있을경우

- /usr/local/share/ca-certificates 에 인증서 파일 copy

- sudo udpate-ca-certificates

 

3. PROXY 존재할 경우 /etc/environment  파일에 proxy 설정

export https_proxy=http://IP:PORT

export http_proxy=http://IP:PORT



4. 토큰

sudo cat /var/lib/rancher/k3s/server/token

K10533485b8ab4818a4c25a942871bb3331f3d6514543bd0d94bd959e0aae85f425::server:941220fbf3b95dc68fd8bfda7366e8d4

 

5. config 위치

/etc/systemd/system

k3s-agent.service

k3s-agent.service.env



6. worker node 생성

 

curl -sfL https://get.k3s.io | K3S_URL=https://$MASTER_IP:6443 \

    K3S_TOKEN=$NODE_TOKEN \

    INSTALL_K3S_EXEC="--node-name worker1 --docker" \

    INSTALL_K3S_VERSION="v1.18.6+k3s1" sh -s -

 

7. pod 가 생성이 안되고 있을 경우 (PROXY 문제였음)

ubuntu@k8s-master:/etc/systemd/system$ kubectl get po --all-namespaces

NAMESPACE     NAME                                     READY   STATUS              RESTARTS   AGE

kube-system   local-path-provisioner-6d59f47c7-724fv   0/1     ContainerCreating   0          7d15h

kube-system   coredns-8655855d6-qtvs2                  0/1     ContainerCreating   0          7d15h


/etc/systemd/system 에 다음과 같이 디렉토리 생성

sudo mkdir docker.service.d

cd docker.service.d

sudo vi http-proxy.conf

 

[Service] Environment="HTTP_PROXY=http://IP:PORT/" "HTTPS_PROXY=http://IP:PORT/" "NO_PROXY=localhost,127.0.0.1,70."

 

그리고 나서 Docker 재기동

systemctl daemon-reload

systemctl restart docker

 

NAMESPACE     NAME                                     READY   STATUS    RESTARTS   AGE
kube-system   local-path-provisioner-6d59f47c7-724fv   1/1     Running   0          7d15h
kube-system   coredns-8655855d6-qtvs2                  1/1     Running   0          7d15h

728x90
반응형

댓글0