Infra/MLops

[k8s]k8s설치하기

뚜둔뚜둔 2022. 2. 15. 13:29

k8s설치하기.

1. master node는 서버에,work node는 docker ubuntu이미지를 띄어서 생성 완료

2022.02.14 - [Infra] - [docker]docker Image Ubuntu 20.04 만들기

k8s 설치 순서 < 따라 배우는 쿠버네티스 강의 참고하여 진행 하였음 >

 

1. install Docker

# 1.Install using the repository

sudo apt-get update

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
    
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

 echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
 # 2. Install Docker Engine
 
 sudo apt-get update
 sudo apt-get install-y docker-ce docker-ce-cli containerd.io
 
 
 # 3. docker 실행, 설치 확인 
 
sudo apt-get remove docker docker.io containderd

sudo apt-get install docker-ce docker-ce-cli containerd.io

sudo service docker start

 

2. Install keburnetes

# 1. Swap disabled
# swapoff -a && sed -i '/swap/s/^/#/' /etc/fstab

# 2. 설치 전 환경 설정
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1

# 3. Disable firewall
systemctl stop firewalld 
systemctl disable firewalld


# 4. kubeadm, kubelet, kubectl 설치
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF

apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl

# 5. 실행
systemctl start kubelet
systemctl enable kubelet

 

참고 : 이성미 강사님 깃 (https://github.com/237summit/k8s_core_labs)

 

 

반응형

'Infra > MLops' 카테고리의 다른 글

[k8s]명령어 정리  (2) 2022.02.15
[k8s] token, certificate-key 찾기  (0) 2022.02.15
git project pull  (0) 2022.02.07
[kubeflow]kubeflow란 ?  (0) 2022.01.26
[GitLab] gitLab에 프로젝트 올리기  (0) 2022.01.25