Kubernetes has become the go-to platform for managing and orchestrating containerized applications. It provides powerful tools and features that enable developers to deploy, scale, and manage applications seamlessly. Setting up a Kubernetes cluster can be a complex task, but with the help of Minikube, an open-source tool, you can easily create a local Kubernetes cluster on your Debian 11 system.
What is Minikube?
Minikube is a free and open-source tool that simplifies the process of setting up a Kubernetes cluster on your local machine. It provides a lightweight and portable environment for developing and testing Kubernetes applications. Minikube comes with a set of built-in add-ons that enhance the functionality of your local cluster. These add-ons include the Kubernetes dashboard, DNS, storage provisioner, and more.
Why Use Minikube?
Minikube offers several advantages for developers and system administrators looking to set up a local Kubernetes cluster. Here are a few reasons why you should consider using Minikube:
- Ease of Use: Minikube provides a simple and straightforward way to create a local Kubernetes cluster without the need for complex setup or configuration.
- Portability: With Minikube, you can easily move your Kubernetes cluster between different machines and operating systems, making it ideal for development and testing.
- Built-in Add-ons: Minikube comes with a range of add-ons that enhance the functionality of your local cluster. These add-ons include the Kubernetes dashboard, DNS, storage provisioner, and more.
- Compatibility: Minikube is cross-platform and supports multiple operating systems, including Linux, macOS, and Windows. It can be deployed as a virtual machine, a container, or on bare metal.
Now that we understand the benefits of using Minikube let’s proceed with the installation process on Debian 11.
Installation Process
To set up Minikube on Debian 11, we need to install Docker, Kubectl, and finally Minikube itself. Let’s go through each step in detail.
Step 1: Install Docker
Before we can install Minikube, we need to ensure that Docker is installed on our Debian 11 system. Docker is a containerization platform that allows you to run applications in isolated environments called containers. To install Docker, follow these steps:
- Open a terminal on your Debian 11 system.
- Run the following command to install Docker:
apt install docker.io -y
- Once the installation is complete, verify the Docker version by running the following command:
docker --version
Output: Docker version 20.10.5+dfsg1, build 55c4c88
Step 2: Install Kubectl
Kubectl is a command-line tool that allows you to interact with your Kubernetes cluster. By default, Kubectl is not available in the Debian 11 default repository, so we need to install it using Snap, a package management system. Follow these steps to install Kubectl:
- Open a terminal on your Debian 11 system.
- Run the following command to install the Snap package:
apt install snapd -y
- Next, create a symbolic link for the Snap package:
ln -s /var/lib/snapd/snap/snap
- Add a Snap path to your system profile:
echo 'export PATH=$PATH:/var/lib/snapd/snap/bin' | tee -a /etc/profile.d/snap.sh
- Start and enable the Snap service:
systemctl enable --now snapd.service snapd.socket
- Install the Kubectl package using Snap:
snap install kubectl --classic
- Create a symbolic link for the Kubectl package:
ln -s /snap/kubectl/current/kubectl /usr/bin/
- Verify the Kubectl version:
kubectl version-o yaml
Output: clientVersion: buildDate: "2022-12-09T16:23:44Z" compiler: gc gitCommit: b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d gitTreeState: clean gitVersion: v1.26.0 goVersion: go1.19.4 major: "1" minor: "26" platform: linux/amd64 kustomizeVersion: v4.5.7
Step 3: Install Minikube
Now that we have Docker and Kubectl installed, we can proceed with installing Minikube. Follow these steps to install Minikube:
- Open a terminal on your Debian 11 system.
- Download the Minikube binary using the following command:
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube
- Copy the Minikube binary to the system path:
cp minikube /usr/local/bin/
- Set the executable permission for the Minikube binary:
chmod +x /usr/local/bin/minikube
- Verify the Minikube version:
minikube version
Output: minikube version: v1.28.0 commit: 986b1ebd987211ed16f8cc10aed7d2c42fc8392f
Great! Now that Minikube is installed on your Debian 11 system, we can proceed to the next step.
Setting Up Minikube
With Minikube installed, we can now proceed to start and configure our local Kubernetes cluster. Follow these steps to set up Minikube:
- Open a terminal on your Debian 11 system.
- Start Minikube with the following command:
minikube start --force
Note: The `--force` flag is used to skip various validations, which can lead to unexpected behavior. If you are running Minikube within a VM, consider using the `--driver=none` option
- Minikube will download the Docker image and configure the Kubernetes cluster. You will see a series of messages indicating the progress of the setup process.
- Once the setup is complete, you can check the cluster status by running the following command:
kubectl cluster-info
Output: Kubernetes control plane is running at https://192.168.49.2:8443 CoreDNS is running at https://192.168.49.2:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
- To check the running nodes in the cluster, run the following command:
kubectlget nodes
Output: NAME STATUS ROLES AGE VERSION minikube Ready control-plane,master 67s v1.25.3
Congratulations! You have successfully set up Minikube and created a local Kubernetes cluster on your Debian 11 system. Now, let’s explore some additional commands and features of Minikube.
Accessing the Minikube Container
Minikube allows you to access the Kubernetes cluster container directly. This can be useful for troubleshooting or debugging purposes. Follow these steps to access the Minikube container:
- Open a terminal on your Debian 11 system.
- Run the following command to access the Minikube container:
minikube ssh You will be logged into the Minikube container's shell. You can now execute commands within the container.
- To exit the container shell, run the following command:
exit
Stopping and Deleting the Kubernetes Cluster
If you no longer need the Kubernetes cluster created by Minikube, you can easily stop and delete it. Follow these steps to stop and delete the cluster:
- Open a terminal on your Debian 11 system.
- To stop the Kubernetes cluster, run the following command:
minikube stop
- To delete the Kubernetes cluster, run the following command:
minikube delete
Checking the Status of Minikube
To check the status of your Minikube installation, use the following command:
minikube status
Output: minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured
Accessing the Minikube Kubernetes Dashboard
Minikube provides a web-based dashboard that allows you to manage and monitor your Kubernetes cluster. To access the dashboard, follow these steps:
- Open a terminal on your Debian 11 system.
- List all the Minikube add-ons using the following command:
minikube addons list
Output: |-----------------------------|----------|--------------|--------------------------------| | ADDON NAME | PROFILE | STATUS | MAINTAINER | |-----------------------------|----------|--------------|--------------------------------| | ambassador | minikube | disabled | 3rd party (Ambassador) | | auto-pause | minikube | disabled | Google | | cloud-spanner | minikube | disabled | Google | | csi-hostpath-driver | minikube | disabled | Kubernetes | | dashboard | minikube | disabled | Kubernetes | | default-storageclass | minikube | enabled ✅ | Kubernetes | | efk | minikube | disabled | 3rd party (Elastic) | | freshpod | minikube | disabled | Google | | gcp-auth | minikube | disabled | Google | | gvisor | minikube | disabled | Google | | headlamp | minikube | disabled | 3rd party (kinvolk.io) | | helm-tiller | minikube | disabled | 3rd party (Helm) | | inaccel | minikube | disabled | 3rd party (InAccel | | | | | [[email protected]]) | | ingress | minikube | disabled | Kubernetes | | ingress-dns | minikube | disabled | Google | | istio | minikube | disabled | 3rd party (Istio) | | istio-provisioner | minikube | disabled | 3rd party (Istio) | | kong | minikube | disabled | 3rd party (Kong HQ) | | kubevirt | minikube | disabled | 3rd party (KubeVirt) | | logviewer | minikube | disabled | 3rd party (unknown) | | metallb | minikube | disabled | 3rd party (MetalLB) | | metrics-server | minikube | disabled | Kubernetes | | nvidia-driver-installer | minikube | disabled | Google | | nvidia-gpu-device-plugin | minikube | disabled | 3rd party (Nvidia) | | olm | minikube | disabled | 3rd party (Operator Framework) | | pod-security-policy | minikube | disabled | 3rd party (unknown) | | portainer | minikube | disabled | 3rd party (Portainer.io) | | registry | minikube | disabled | Google | | registry-aliases | minikube | disabled | 3rd party (unknown) | | registry-creds | minikube | disabled | 3rd party (UPMC Enterprises) | | storage-provisioner | minikube | enabled ✅ | Google | | storage-provisioner-gluster | minikube | disabled | 3rd party (Gluster) | | volumesnapshots | minikube | disabled | Kubernetes | |-----------------------------|----------|--------------|--------------------------------|
- To access the Kubernetes dashboard, run the following command:
minikube dashboard --url
Output: Enabling dashboard ... Using image docker.io/kubernetesui/metrics-scraper:v1.0.8 Using image docker.io/kubernetesui/dashboard:v2.7.0 Some dashboard features require the metrics-server add-on. To enable all features, please run: minikube addons enable metrics-server Verifying dashboard health ... Launching proxy ... Verifying proxy health ... http://127.0.0.1:45627/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
- By default, the Minikube dashboard is accessible only from the local machine. If you want to access it from an external machine, run the following command:
kubectl proxy --address='0.0.0.0' --disable-filter=true
- Open your web browser and enter the URL
http://your-server-ip:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
.Note: Replaceyour-server-ip
with the IP address of your Debian 11 system. - You will be redirected to the Kubernetes dashboard, where you can manage and monitor your Minikube cluster.
Conclusion
In this tutorial, we learned how to set up a Kubernetes cluster using Minikube on Debian 11. We installed Docker, Kubectl, and Minikube, and then started and configured our local Kubernetes cluster. We also explored additional commands and features of Minikube, such as accessing the Minikube container and managing the Kubernetes cluster using the Minikube dashboard.
Minikube provides a convenient way to set up and manage a local Kubernetes cluster for development and testing purposes. It allows you to leverage the power of Kubernetes without the need for a full-scale production environment.
If you’re looking for reliable and scalable cloud hosting solutions for your Kubernetes clusters, consider Shape.host’s Cloud VPS services. Shape.host offers high-performance SSD VPS hosting with robust security features and excellent customer support. Visit Shape.host to learn more about their services and find the perfect hosting solution for your needs.