본문 바로가기

TEAM STUDY/쿠버네티스

vm 에 도커깔고 쿠버깔고 겨우 성공함 💥

728x90
반응형

도커 깔기

 

도커 우분투 기반 설치

 

Install Docker Engine on Ubuntu

 

docs.docker.com

 

 

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

 

sudo apt-get update

sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

systemctl enable docker


systemctl start docker

 

docker version

 


쿠버네티스 깔기

 

swapoff -a && sed -i '/swap/s/^/#/' /etc/fstab

cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF

cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

sudo sysctl --system

ufw disable

apt-get update & apt-get install -y apt-transport-https curl

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

sudo apt-get update && apt-get install -y kubelet=1.20.15-00 kubeadm=1.20.15-00 kubectl=1.20.15-00
apt-mark hold kubelet kubeadm kubectl

systemctl start kubelet
systemctl enable kubelet


master 

 

kubeadm init

kubectl get nodes --all-namespaces


nodes

 

kubeadm join 10.100.0.105:6443 --token z5m1xl.qzbo8y9a3ym2v6cp \
    --discovery-token-ca-cert-hash sha256:1eadb9353f4783b2d4f1bc832879d164b3700757f22051329f14e99cd6cf0fa7

 

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

 

kubectl get nodes

 

kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"


THE END


728x90
반응형