Day-3 Kubeadm setup and make a MultiNode cluster.
For k8s deployment the machine`s minimum requirements:-
t2.medium
2 Virtual Cpu
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:-
Kubectl
: It is a command line tool, it is allows you to run commands against k8s cluster.tee
: One file contant mount in another file.
echo "dev
https://apt.kubetnetes.io/kubernetes-xenial
main"/ 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.
sed
: stream editorit is like vim or grep editor.
And sed is the advanced tool for editing in file.
sudo swapoff -a
:- For off the swap memory.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
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.