Minikube
While docker and docker-compose are simple and fulfill the basic requirement, I prefer Kubernetes' way of managing containers also can be scaled. So, if there is some problem in one pod, Kubernetes automatically fixes the pod, recovering the downtime.
Kubernetes can be best managed by creating multiple nodes, but setting Kubernetes cluster at home seems advanced. So, we need to find out a way to set up a Kubernetes cluster in one machine in a single node, and Minikube is developed for that. There are some alternatives to Minikube like Kind and k3s, but I am going to install Minikube and learn Kubernetes concepts. My final goal will be to fully deploy my services into Kubernetes, the services are currently running on Docker.
So, here I describe all the processes to make Minikube's single node up and running.
1) Installation of docker (in Ubuntu, tested in 22.04)
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo mkdir -m 0755 -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 install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Test the installation
sudo docker run hello-world
Check if everything is fine
sudo service docker status
sudo systemctl status docker.service
sudo systemctl is-enabled docker.service
sudo systemctl is-active docker.service
sudo docker compose version
Add user to docker group (so that you do not need to provide sudo with docker)
Check if the docker group exists in /etc/group file. If no, add a docker group.
sudo groupadd docker
Add the user to the docker group.
sudo usermod -aG docker $USER
Restart the system, test
docker run hello-world
Refefence: https://docs.docker.com/engine/install/ubuntu/
2) Installation of Minikube
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Verify
minikube version
Start
minikube start
Ref: https://r2schools.com/how-to-install-minikube-on-ubuntu-22-04-lts/
3) Installation of kubectl
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 install kubectl /usr/local/bin/kubectl
Verify
kubectl version -o json --client
Ref: https://r2schools.com/how-to-install-minikube-on-ubuntu-22-04-lts/
4) Enable autocomplete for kubectl
- Check if bash-completion is already installed.
- Enable kubectl autocompletion and reload bash
- Setup alias for kubectl
- Enable the alias for auto-completion and reload bash. (source ~/.bashrc)
Reference: https://spacelift.io/blog/kubectl-auto-completion
No comments:
Post a Comment