Introduction
This guide will cover the installation of Minikube on Debian 12 Bookworm using the 5W1H (What, Who, Where, When, Why, How) approach. We'll also discuss the consequences and conclude with a summary.
Overview
What
Minikube is a tool that enables you to run a single-node Kubernetes cluster on your local machine. It's useful for learning Kubernetes and testing applications locally.
Who
This guide is intended for developers, system administrators, and IT professionals who want to install and use Minikube on Debian 12 Bookworm.
Where
You can install Minikube on any machine running Debian 12 Bookworm, whether it's a physical machine or a virtual machine.
When
Install Minikube when you need a local Kubernetes environment for development, testing, or learning purposes.
Why
Using Minikube on Debian 12 Bookworm has several pros and cons:
Pros | Cons |
---|---|
|
|
How
Follow these steps to install Minikube on Debian 12 Bookworm:
Step 1: | Update your system: sudo apt update && sudo apt upgrade -y |
Step 2: | Install dependencies: sudo apt install -y curl apt-transport-https |
Step 3: | Download Minikube: curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 |
Step 4: | Install Minikube: sudo install minikube-linux-amd64 /usr/local/bin/minikube |
Step 5: | Start Minikube: minikube start |
Consequences
Installing and using Minikube on Debian 12 Bookworm can have several consequences:
Positive |
|
Negative |
|
Conclusion
Minikube is a valuable tool for anyone looking to run Kubernetes locally on Debian 12 Bookworm. While it has some limitations, its ease of use and flexibility make it an excellent choice for development, learning, and testing.
Install Minikube.
Install Minikube to configure Kubernetes Cluster on single node.
Step [1] Install a Hypervisor first that is supported by Minikube. On this example, Install KVM. For other Hypervisors, it's possible to use VirtualBox, VMware Fusion, HyperKit.
Step [2]Run Snapd, refer to here.
Step [3]Install Minikube and other required tools.
# install kubectl
root@dlp:~# snap install kubectl --classic
kubectl 1.27.3 from Canonical✓ installed
root@dlp:~# wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube
root@dlp:~# wget https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2
root@dlp:~# chmod 755 minikube docker-machine-driver-kvm2
root@dlp:~# mv minikube docker-machine-driver-kvm2 /usr/local/bin/
root@dlp:~# minikube version
minikube version: v1.30.1
commit: 08896fd1dc362c097c925146c4a0d0dac715ace0
if use by common users, add them to [libvirt] group
root@dlp:~# usermod -aG libvirt debian
Step [4]Start Minikube with a common user.
debian@dlp:~$ minikube start --vm-driver=kvm2
* minikube v1.30.1 on Debian 12.0 (kvm/amd64)
* Using the kvm2 driver based on user configuration
* Downloading VM boot image ...
> minikube-v1.30.1-amd64.iso....: 65 B / 65 B [---------] 100.00% ? p/s 0s
> minikube-v1.30.1-amd64.iso: 282.84 MiB / 282.84 MiB 100.00% 34.15 MiB p
* Starting control plane node minikube in cluster minikube
* Downloading Kubernetes v1.26.3 preload ...
> preloaded-images-k8s-v18-v1...: 397.02 MiB / 397.02 MiB 100.00% 38.09 M
* Creating kvm2 VM (CPUs=2, Memory=3900MB, Disk=20000MB) ...
* Preparing Kubernetes v1.26.3 on Docker 20.10.23 ...
- Generating certificates and keys ...
- Booting up control plane ...
- Configuring RBAC rules ...
* Configuring bridge CNI (Container Networking Interface) ...
- Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Verifying Kubernetes components...
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
# show status
debian@dlp:~$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
debian@dlp:~$ minikube service list
|-------------|------------|--------------|-----|
| NAMESPACE | NAME | TARGET PORT | URL |
|-------------|------------|--------------|-----|
| default | kubernetes | No node port |
| kube-system | kube-dns | No node port |
|-------------|------------|--------------|-----|
debian@dlp:~$ minikube docker-env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.39.42:2376"
export DOCKER_CERT_PATH="/home/debian/.minikube/certs"
export MINIKUBE_ACTIVE_DOCKERD="minikube"
# To point your shell to minikube's docker-daemon, run:
# eval $(minikube -p minikube docker-env)
debian@dlp:~$ kubectl cluster-info
Kubernetes control plane is running at https://192.168.39.42:8443
CoreDNS is running at https://192.168.39.42:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
debian@dlp:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 2m4s v1.26.3
# a VM [minikube] is just running
debian@dlp:~$ sudo virsh list
Id Name State
--------------------------
1 minikube running
# possible to access with SSH to the VM
debian@dlp:~$ minikube ssh
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
$ hostname
minikube
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4582fb53b223 5185b96f0bec "/coredns -conf /etc…" 2 minutes ago Up 2 minutes k8s_coredns_coredns-787d4945fb-fhlnr_kube-system_ea777e06-da13-4c0c-809a-90409f888259_0
9193904e839f registry.k8s.io/pause:3.9 "/pause" 2 minutes ago Up 2 minutes k8s_POD_coredns-787d4945fb-fhlnr_kube-system_ea777e06-da13-4c0c-809a-90409f888259_0
d5444e4911d2 6e38f40d628d "/storage-provisioner" 2 minutes ago Up 2 minutes k8s_storage-provisioner_storage-provisioner_kube-system_c11506ec-72e9-42f0-b87a-7adc5bc77e71_0
d528456e7ab1 92ed2bec97a6 "/usr/local/bin/kube…" 2 minutes ago Up 2 minutes k8s_kube-proxy_kube-proxy-mzds8_kube-system_80754b13-0d66-422a-b7e4-f584b0d66745_0
5c0cca8c1af4 registry.k8s.io/pause:3.9 "/pause" 2 minutes ago Up 2 minutes k8s_POD_storage-provisioner_kube-system_c11506ec-72e9-42f0-b87a-7adc5bc77e71_0
3b350e970332 registry.k8s.io/pause:3.9 "/pause" 2 minutes ago Up 2 minutes k8s_POD_kube-proxy-mzds8_kube-system_80754b13-0d66-422a-b7e4-f584b0d66745_0
209a2934c18d fce326961ae2 "etcd --advertise-cl…" 3 minutes ago Up 3 minutes k8s_etcd_etcd-minikube_kube-system_284d33246f81afe3f4e224f449e64f2e_0
eeacd6c4ea58 ce8c2293ef09 "kube-controller-man…" 3 minutes ago Up 3 minutes k8s_kube-controller-manager_kube-controller-manager-minikube_kube-system_52fd999db5ff4014b83a4ad42c06b3b5_0
725040ce437a 5a7904736932 "kube-scheduler --au…" 3 minutes ago Up 3 minutes k8s_kube-scheduler_kube-scheduler-minikube_kube-system_0818f4b1a57de9c3f9c82667e7fcc870_0
6d75deeb2913 1d9b3cbae03c "kube-apiserver --ad…" 3 minutes ago Up 3 minutes k8s_kube-apiserver_kube-apiserver-minikube_kube-system_c8fb1e120f04ba61cb934126a250b35e_0
0a46ac1ae435 registry.k8s.io/pause:3.9 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-scheduler-minikube_kube-system_0818f4b1a57de9c3f9c82667e7fcc870_0
927f5e751723 registry.k8s.io/pause:3.9 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-controller-manager-minikube_kube-system_52fd999db5ff4014b83a4ad42c06b3b5_0
20789a32cef2 registry.k8s.io/pause:3.9 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-apiserver-minikube_kube-system_c8fb1e120f04ba61cb934126a250b35e_0
ecbfd3d6ce06 registry.k8s.io/pause:3.9 "/pause" 3 minutes ago Up 3 minutes k8s_POD_etcd-minikube_kube-system_284d33246f81afe3f4e224f449e64f2e_0
$ exit
# stop minikube
debian@dlp:~$ minikube stop
* Stopping "minikube" in kvm2 ...
* Node "minikube" stopped.
# start minikube
debian@dlp:~$ minikube start
* minikube v1.30.1 on Debian 12.0 (kvm/amd64)
* Using the kvm2 driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Restarting existing kvm2 VM for "minikube" ...
* Preparing Kubernetes v1.26.3 on Docker 20.10.23 ...
* Configuring bridge CNI (Container Networking Interface) ...
* Verifying Kubernetes components...
- Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
# remove minikube
debian@dlp:~$ minikube delete
Deleting local Kubernetes cluster...
Machine deleted.
debian@dlp:~$ sudo virsh list --all
Id Name State
--------------------------
Minikube : Basic Usage.
This is the basic operation on Single Node Kubernetes Cluster on Minikube.
Step [1]Create or Delete Pods.
# run [test-nginx] pods
debian@dlp:~$ kubectl create deployment test-nginx --image=nginx
deployment.apps/test-nginx created
debian@dlp:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
test-nginx-6b4d69f6f8-skn67 1/1 Running 0 20s
# show environment variable for [test-nginx] pod
debian@dlp:~$ kubectl exec test-nginx-6b4d69f6f8-skn67 -- env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=test-nginx-6b4d69f6f8-skn67
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
KUBERNETES_SERVICE_HOST=10.96.0.1
KUBERNETES_SERVICE_PORT=443
NGINX_VERSION=1.25.1
NJS_VERSION=0.7.12
PKG_RELEASE=1~bookworm
HOME=/root
# shell access to [test-nginx] pod
debian@dlp:~$ kubectl exec -it test-nginx-6b4d69f6f8-skn67 -- bash
root@test-nginx-6b4d69f6f8-skn67:/# hostname
test-nginx-6b4d69f6f8-skn67
root@test-nginx-6b4d69f6f8-skn67:/# exit
# show logs of [test-nginx] pod
debian@dlp:~$ kubectl logs test-nginx-6b4d69f6f8-skn67
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2023/06/21 04:07:45 [notice] 1#1: using the "epoll" event method
2023/06/21 04:07:45 [notice] 1#1: nginx/1.25.1
.....
.....
# scale out pods
debian@dlp:~$ kubectl scale deployment test-nginx --replicas=3
deployment.apps/test-nginx scaled
debian@dlp:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
test-nginx-6b4d69f6f8-5tbkg 1/1 Running 0 6s
test-nginx-6b4d69f6f8-m6wcq 1/1 Running 0 6s
test-nginx-6b4d69f6f8-skn67 1/1 Running 0 3m37s
# set service
debian@dlp:~$ kubectl expose deployment test-nginx --type="NodePort" --port 80
service/test-nginx exposed
debian@dlp:~$ kubectl get services test-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
test-nginx NodePort 10.98.219.58 <none> 80:31628/TCP 6s
debian@dlp:~$ minikube service test-nginx --url
http://192.168.39.42:31628
debian@dlp:~$ curl http://192.168.39.42:31628
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
.....
.....
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
# delete service
debian@dlp:~$ kubectl delete services test-nginx
service "test-nginx" deleted
# delete pods
debian@dlp:~$ kubectl delete deployment test-nginx
deployment.extensions "test-nginx" deleted
- Get link
- X
- Other Apps
Comments
Post a Comment
Thank you for your comment! We appreciate your feedback, feel free to check out more of our articles.
Best regards, Bizantum Blog Team.