top of page
  • Writer's pictureNikhil Verma

Build Jenkins Pipeline Using Git, Docker Hub, Podman and Kubernetes - Part 2

In part 2 we will deploy Kubernetes cluster:

In my deployment i am using two node cluster one is Master and 2nd one is Worker.

1) Start both VMs; server, worker1 and login as root user.

2) vi /etc/yum.repos.d/kubernetes.repo


3) Install Podman and container tools:

  • dnf install -y dnf-utils wget tree tar git curl

  • dnf module list container-tools

  • dnf module install container-tools/common


  • tar -xzf containerd-1.7.2-linux-amd64.tar.gz

  • mv bin/* /usr/local/bin/

4) Create a Systemd Unit file for containerd to run it as a service.

  • vi /etc/systemd/system/containerd.service

Description=containerd container runtime

#uncomment to enable the experimental sbservice (sandboxed) version of containerd/cri integration
ExecStartPre=-/sbin/modprobe overlay

# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.


  • systemctl enable --now podman.socket

  • set selinux in disabled state

Disable swap on both VMs. K8s will not work with swap on. For permanently disable swap, comment out the last line in /etc/fstab.

  • vi /etc/fstab

  • systemctl daemon-reload && systemctl enable --now containerd

Reboot VM.

4) Download CNI Plugin and move to search path. Restart the Containerd Service

  • wget

  • mkdir -p /opt/cni/bin

  • tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.3.0.tgz

  • systemctl restart containerd

5) Run the package update command on both VMs; server and tester1. Note that it may take 15 to 20 Min. If the dnf package installer is busy, don’t panic and interrupt it. This might be due to auto update running.

  • dnf update -y

6) Install kubeadm and other essential packages required for Kubernetes on all VMs; server and tester1.

  • dnf install ipvsadm iproute-tc kubeadm -y

7) Enable Net packet filter with following command on both VMs.

  • modprobe br_netfilter

  • echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables

8) Edit /etc/sysctl.conf and add following lines to the file

  • vi /etc/sysctl.conf

net.bridge.bridge-nf-call-ip6tables = 1 

9) Run the following command : sysctl -p

10) Reboot both VM's.

Setting Up Master Node

1) Setting Up firewall rules :

  • firewall-cmd --permanent --add-port={10248,10250-10252,10255,2379,2380,6443}/tcp

  • firewall-cmd --reload

2) Enable Kubelet service :

  • systemctl enable --now kubelet

Pull images required to initialize and setup kubernetes server:

  • kubeadm config images pull

  • kubeadm init --apiserver-advertise-address=xx.xx.xx.xx --pod-network-cidr=

Execute the following commands to use the cluster as root user :

  • mkdir -p $HOME/.kube

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

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

Take a copy of Cluster Join URL.

3) Deploy CNI network :

  • kubectl apply -f

Setting Up worker Nodes

1) Configure Firewall Rules :

  • firewall-cmd --permanent --add-port={10250,10255,30000-32767,6783}/tcp

  • firewall-cmd --reload

2) Enable Kubelet service :

  • systemctl enable --now kubelet

  • systemctl enable --now kubelet

3) Join worker nodes to cluster .

Verify Node status :

  • kubectl get nodes

In next part we will learn about Jenkins Configuration.

22 views0 comments
bottom of page