fbpx
bg_image
Comments Off on Minikube on AWS: K8s Single Node Jenkins & Network Plugins
Posted By

Muhammad Aqib

Avatar Of Muhammad Aqib

In the vast landscape of container orchestration, Kubernetes stands tall as a powerhouse, streamlining deployment, scaling, and management of containerized applications. In this blog post, we are going to cover How to Install Minikube, Kubectl, Docker and jenkins on Ubuntu 22.04 LTS AWS EC2 Instance.

In the vast landscape of container orchestration, Kubernetes stands tall as a powerhouse, streamlining deployment, scaling, and management of containerized applications. In this blog post, we are going to cover How to Install Minikube,. Kubectl, Docker and jenkins on Ubuntu 22.04 LTS AWS EC2 Instance.

Minikube Installation Guide

System Requirements for Minikube and Jenkins:

  • Minimum 2 CPU’s or more
  • Minimum 2GB of free memory
  • Minimum 20GB of free disk space
  • Internet connection
Create t2.medium aws ec2 instance with 20GB ebs volume to perform installation.

Install JDK on AWS EC2 Instance:

Install java on ec2 instance using below commands:

				
					sudo apt-get update
sudo apt install openjdk-11-jre-headless -y
java --version

				
			

Install and Setup Jenkins:

Install and setups server using below commands:

				
					sudo curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee   /usr/share/keyrings/jenkins-keyring.asc > /dev/null
sudo echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]   https://pkg.jenkins.io/debian-stable binary/ | sudo tee   /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins
sudo systemctl enable jenkins

				
			

Assigning administration privileges:

				
					    sudo vi /etc/sudoers
				
			

Add the following line at the end of the file
jenkins ALL=(ALL) NOPASSWD: ALL
Open your web browser and paste http://{ ec2 instance public ip}:8080 to access the application. Wait until the Unlock Jenkins page appears.

				
					sudo cat /var/lib/jenkins/secrets/initialAdminPassword
				
			

Copy the password from either location and paste it in the password field.
Next, select Install Suggested Plugins to allow the installation of the necessary plugins. These are the basic plugins that requires to run.
After installing all the basic plugins, you will be redirected to another page for you to create your first admin user.
Note:
After create the admin user, Install Docker Pipeline and Kubernetes Plugin in Jenkins server from Manage Jenkins -> Plugins -> Available plugins.

Install kubectl:

Download and install kubectl using below command:

				
					curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version

				
			

Install Docker:

Install docker and some packages for docker using below commands:

				
					sudo apt-get install  ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.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 docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl status docker
sudo groupadd docker
sudo usermod -aG docker $USER && newgrp docker
sudo usermod -aG docker jenkins
sudo systemctl enable docker
sudo systemctl status docker
sudo reboot
sudo systemctl start docker.service

				
			

Install cri-dockerd:

Install default network plugin for cri-dockerd is set to cni on Ubuntu for new Kubernetes version as following:

				
					sudo snap install go --classic
	git clone https://github.com/Mirantis/cri-dockerd.git
source ~/.bashrc
cd cri-dockerd
mkdir bin
go build -o bin/cri-dockerd
Note: Above command takes some time to complete.
mkdir -p /usr/local/bin
sudo install -o root -g root -m 0755 bin/cri-dockerd /usr/local/bin/cri-dockerd
sudo cp -a packaging/systemd/* /etc/systemd/system     /* Here * is used for all packages.*/
sudo sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
sudo systemctl daemon-reload
sudo systemctl enable cri-docker.service
sudo systemctl enable --now cri-docker.socket
sudo apt-get install -y conntrack
cd ~

				
			

Install crictl package:

Install crictl: CLI for kubelet CRI on Ubuntu using below commands:

				
					VERSION="v1.24.2"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-$VERSION-linux-amd64.tar.gz	

				
			

Install Container Networking Plugins for none-driver:

Install container networking plugins for none driver using below commands:

				
					CNI_PLUGIN_VERSION="v1.4.0"
CNI_PLUGIN_TAR="cni-plugins-linux-amd64-$CNI_PLUGIN_VERSION.tgz"
CNI_PLUGIN_INSTALL_DIR="/opt/cni/bin"
curl -LO "https://github.com/containernetworking/plugins/releases/download/$CNI_PLUGIN_VERSION/$CNI_PLUGIN_TAR"
sudo mkdir -p "$CNI_PLUGIN_INSTALL_DIR"
sudo tar -xf "$CNI_PLUGIN_TAR" -C "$CNI_PLUGIN_INSTALL_DIR"
rm "$CNI_PLUGIN_TAR"

				
			

Download and Install Minikube:

Download and Install Minikubes on Ubuntu 22.04 LTS using below commands:

				
					curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube version
minikube start --vm-driver=none --network-plugin=cni --cni=calico	
minikube status

				
			

Congratulations on setting up Jenkin, Docker, Kubectl, network plugins, and Minikube on your Ubuntu machine hosted on AWS! Take your deployment to the next level with our guide: Deploy on AWS in Minutes: GitLab Runner, ECR & EKS Guide. You can explore a lot more now with Musewerx!