K8S Install with Kubeadm

김재진·2023년 9월 22일


To summerize How to install k8s with kubeadm on ubuntu
It refer from below:
k8s install: https://kubernetes.io/ko/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
Runtime(crio): https://github.com/cri-o/cri-o/blob/main/install.md
cni install: https://docs.tigera.io/calico/latest/getting-started/kubernetes/self-managed-onprem/onpremises


swapoff -a
sudo vi /etc/sysctl.conf

sudo sysctl -p

cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1

sudo sysctl --system

kubectl install

First install the kubectl, kubeadm, kubelet for using kubernetes

  • kubeadm: It can operate k8s cluster and configuring
  • kubectl: It is command line tool for communicating with a Kubernetes cluster's control plane, using the Kubernetes API.
  • kubelet: This is agent for control pods which is running on the nodes
  1. update the apt packages
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
  1. get signing key for Kubernetes package repositorties
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
  1. Add the appropriate kubernetes apt repository. If you desire other version, replace 'v1.28' with the desired minor version in the command below
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
  1. install kubelet,kubeadm,kubectl
sudo apt-get update
sudo apt-get install -y kubectl kubeadm kubelet

Install Runtime(CRIO)

  1. Create config file which is load module when booting it
cat <<EOF | sudo tee /etc/modules-load.d/crio.conf

sudo modprobe overlay
sudo modprobe br_netfilter
  1. configure sysctl parameter for Cri-o, This parameter will maintained even on server restart
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1

sudo sysctl --system
  1. (optional) If You want cgroupfs cgroup driver, Follow guide below:
cgroupfs cgroup 드라이버로 전환하려면, /etc/crio/crio.conf 를 수정하거나 /etc/crio/crio.conf.d/02-cgroup-manager.conf 에 드롭-인(drop-in) 구성을 배치한다.

conmon_cgroup = "pod"
cgroup_manager = "cgroupfs"
  1. Cri-o install
export OS=xUbuntu_22.04
export CRIO_VERSION=1.24

echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list

echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$CRIO_VERSION/$OS/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$CRIO_VERSION.list

sudo apt update
sudo apt install cri-o cri-o-runc

sudo systemctl start crio
sudo systemctl enable crio

k8s configure

  1. kubeadm init (master) - Folllow msg after initializing k8s master node
sudo kubeadm init --apiserver-advertise-address=<master node IP or DNS address> --pod-network-cidr=
  1. kubeadm join (worker) -
kubeadm join <master node>

configure CNI (calico)

  1. Install Calico CNI plugin\
curl https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/custom-resources.yaml -O
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/tigera-operator.yaml

watch kubectl get pods -n calico-system
주니어 엔지니어입니다.

0개의 댓글