티스토리 뷰
Prequisite
- OS (+ network)
- Docker
- 스왑 오프
swapoff -a
Kubernetes 레포지토리 구성
$ sudo apt-get update
$ sudo apt-get install -y apt-transport-https ca-certificates curl
$ sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
$ sudo apt-get update
Kubelet, Kubeadm, Kubectl 설치
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
systemctl daemon-reload
systemctl enable kubelet
systemctl start kubelet
systemctl status kubelet
kubeadm init
kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=10.0.2.15
--pod-network-cidr : flannel이 cidr을 사용하기 위해
--apiserver-advertise-address: master node의 ip주소
Get http://localhost:10248/healthz: dial tcp 127.0.0.1:10248: connect: connection refused 에러해결
kubeadm token (worker node를 추가할 때 사용)
kubeadm을 성공적으로 init하면 다음과 같은 문구가 뜸
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join <master-ip>:<master-port> --token <token> --discovery-token-ca-cert-hash sha256:<hash>
- 발급된 토큰은 24시간 제한있음
- 유효시간을 지나면
kubeadm token create
명령어를 통해 재발급 가능
--discovery-token-ca-cert-hash를 모를 경우
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
export KUBECONFIG=/etc/kubernetes/admin.conf
CNI설치
flannel
'CLOUD > Kubernetes' 카테고리의 다른 글
kubernetes 에러해결 마스터노드 The connection to the server 10.0.2.15:6443 was refused - did you specify the right host or port? (1) | 2022.03.16 |
---|---|
[kubernetes/k8s] 쿠버네티스 클러스터 구성하기 #2 Worker node (0) | 2022.03.16 |
statefulset 디버깅하기 (0) | 2022.02.10 |
도커로 vscode 서버 설치 (+ 쿠버네티스 컨테이너로 올리기) code-server (0) | 2022.01.12 |
[Kubernetes] secret을 만들어서 ingress에 openssl tls적용 (crt, key) (0) | 2021.11.01 |