Day-3 Kubeadm setup and make a MultiNode cluster.

Vaibhav JainVaibhav Jain
2 min read

For k8s deployment the machine`s minimum requirements:-

  1. t2.medium

  2. 2 Virtual Cpu

  3. 2 Gb Ram

Presistant Volume:- A Persistant volume is a piece of a cluster that an administrator has provisioned.

* K8s not work on ip its work on DNS.


Commands:-

  1. Kubectl: It is a command line tool, it is allows you to run commands against k8s cluster.

  2. tee : One file contant mount in another file.

echo "devhttps://apt.kubetnetes.io/kubernetes-xenialmain"/ sudo tee /etc/apt/source.list.d/kubernetes.list

--normally used to split the output of a program so that it can be both displayed and saved in file.

  1. sed : stream editor

    it is like vim or grep editor.

    And sed is the advanced tool for editing in file.

    1. sudo swapoff -a :- For off the swap memory.

    2. free -m :- To verify or check the memory management.


ubeadm_v1.29 setup commands:-

These commands is for the manager node:-

# kubernetes
Learning k8s confriguration 
---------------------------------------

sudo apt-get update -y

sudo apt-get install -y apt-transport-https ca-certificates curl gpg

sudo curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg

sudo mkdir -p -m 755 /etc/apt/keyrings

sudo curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg

echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list

sudo apt-get update

sudo apt-get install -y kubelet kubeadm kubectl

sudo apt-mark hold kubelet kubeadm kubectl
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
sudo swapoff -a
sudo modprobe overlay
sudo modprobe br_netfilter

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

sudo sysctl --system

sudo tee /etc/modules-load.d/containerd.conf <<EOF
overlay
br_netfilter
EOF

sudo sysctl --system

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt update

sudo apt install -y containerd.io

mkdir -p /etc/containerd

containerd config default | sudo tee /etc/containerd/config.toml

sudo systemctl restart containerd

sudo systemctl enable containerd

sudo systemctl enable kubelet

kubectl version

sudo kubeadm config images pull --cri-socket /run/containerd/containerd.sock --kubernetes-version v1.29.2

sudo kubeadm init   --pod-network-cidr=10.244.0.0/16   --upload-certs --kubernetes-version=v1.29.2  --control-plane-endpoint=ip --ignore-preflight-errors=all  --cri-socket /run/containerd/containerd.sock

mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

kubectl apply -f https://github.com/coreos/flannel/raw/master/Documentationkube-flannel.yml
0
Subscribe to my newsletter

Read articles from Vaibhav Jain directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vaibhav Jain
Vaibhav Jain

i am learning devops tools and shere my thoughts and experiences that may help in your devops learning journey.