Minikube : Install2022/09/02 |
Install Minikube to configure Kubernetes Cluster on single node.
|
[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. |
[2] | |
[3] | Install Minikube and other required tools. |
# install kubectl root@dlp:~# snap install kubectl --classic kubectl 1.24.4 from Canonical✓ installed 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:~#
root@dlp:~# mv minikube docker-machine-driver-kvm2 /usr/local/bin/
minikube version minikube version: v1.26.1 commit: 62e108c3dfdec8029a890ad6d8ef96b6461426dc |
[4] | Start Minikube with a common user. |
ubuntu@dlp:~$ minikube start --vm-driver=kvm2 * minikube v1.26.1 on Ubuntu 22.04 (kvm/amd64) * Using the kvm2 driver based on user configuration * Downloading VM boot image ... > minikube-v1.26.1-amd64.iso....: 65 B / 65 B [---------] 100.00% ? p/s 0s > minikube-v1.26.1-amd64.iso: 270.83 MiB / 270.83 MiB 100.00% 33.66 MiB p * Starting control plane node minikube in cluster minikube * Downloading Kubernetes v1.24.3 preload ... > preloaded-images-k8s-v18-v1...: 405.75 MiB / 405.75 MiB 100.00% 35.00 M * Creating kvm2 VM (CPUs=2, Memory=4000MB, Disk=20000MB) ... * Preparing Kubernetes v1.24.3 on Docker 20.10.17 ... - Generating certificates and keys ... - Booting up control plane ... - Configuring RBAC rules ... * Verifying Kubernetes components... - Using image gcr.io/k8s-minikube/storage-provisioner:v5 * Enabled addons: default-storageclass, storage-provisioner * Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default # show status ubuntu@dlp:~$ minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configuredubuntu@dlp:~$ minikube service list |-------------|------------|--------------|-----| | NAMESPACE | NAME | TARGET PORT | URL | |-------------|------------|--------------|-----| | default | kubernetes | No node port | | kube-system | kube-dns | No node port | |-------------|------------|--------------|-----|ubuntu@dlp:~$ minikube docker-env export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.39.137:2376" export DOCKER_CERT_PATH="/home/ubuntu/.minikube/certs" export MINIKUBE_ACTIVE_DOCKERD="minikube" # To point your shell to minikube's docker-daemon, run: # eval $(minikube -p minikube docker-env)ubuntu@dlp:~$ kubectl cluster-info Kubernetes control plane is running at https://192.168.39.137:8443 CoreDNS is running at https://192.168.39.137:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.ubuntu@dlp:~$ kubectl get nodes NAME STATUS ROLES AGE VERSION minikube Ready control-plane 2m20s v1.24.3 # a VM [minikube] is just running ubuntu@dlp:~$ virsh list Id Name State -------------------------- 1 minikube running # possible to access with SSH to the VM ubuntu@dlp:~$ minikube ssh _ _ _ _ ( ) ( ) ___ ___ (_) ___ (_)| |/') _ _ | |_ __ /' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\ | ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/ (_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
$
$ hostname minikube docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ba2df987dbd4 6e38f40d628d "/storage-provisioner" 2 minutes ago Up 2 minutes k8s_storage-provisioner_storage-provisioner_kube-system_a4f316b2-135a-4e62-807e-840884787ca2_1 affc76530cad a4ca41631cc7 "/coredns -conf /etc…" 2 minutes ago Up 2 minutes k8s_coredns_coredns-6d4b75cb6d-9rmvr_kube-system_7edf8f2c-0854-4abd-8b5b-282ac404c648_0 d4f57dece8cf 2ae1ba6417cb "/usr/local/bin/kube…" 2 minutes ago Up 2 minutes k8s_kube-proxy_kube-proxy-v7nw2_kube-system_065252cb-00b4-4d42-9aa1-1e0d082061d0_0 47f5ed394665 k8s.gcr.io/pause:3.6 "/pause" 2 minutes ago Up 2 minutes k8s_POD_coredns-6d4b75cb6d-9rmvr_kube-system_7edf8f2c-0854-4abd-8b5b-282ac404c648_0 291f0c42fa76 k8s.gcr.io/pause:3.6 "/pause" 2 minutes ago Up 2 minutes k8s_POD_storage-provisioner_kube-system_a4f316b2-135a-4e62-807e-840884787ca2_0 4d913a4ff693 k8s.gcr.io/pause:3.6 "/pause" 2 minutes ago Up 2 minutes k8s_POD_kube-proxy-v7nw2_kube-system_065252cb-00b4-4d42-9aa1-1e0d082061d0_0 241694551ccb 3a5aa3a515f5 "kube-scheduler --au…" 3 minutes ago Up 3 minutes k8s_kube-scheduler_kube-scheduler-minikube_kube-system_2e95d5efbc70e877d20097c03ba4ff89_0 0dcd9a257722 586c112956df "kube-controller-man…" 3 minutes ago Up 3 minutes k8s_kube-controller-manager_kube-controller-manager-minikube_kube-system_4f82078a5dfd579f16196dd9ef946750_0 fa273da5f334 aebe758cef4c "etcd --advertise-cl…" 3 minutes ago Up 3 minutes k8s_etcd_etcd-minikube_kube-system_14e9e190fb437f166f99d456e822620c_0 f2e203d8d469 d521dd763e2e "kube-apiserver --ad…" 3 minutes ago Up 3 minutes k8s_kube-apiserver_kube-apiserver-minikube_kube-system_dcc1d668a2ae9bf4dd040a9a8565027e_0 55718f04b123 k8s.gcr.io/pause:3.6 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-controller-manager-minikube_kube-system_4f82078a5dfd579f16196dd9ef946750_0 720397b4f602 k8s.gcr.io/pause:3.6 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-scheduler-minikube_kube-system_2e95d5efbc70e877d20097c03ba4ff89_0 61925267ebf0 k8s.gcr.io/pause:3.6 "/pause" 3 minutes ago Up 3 minutes k8s_POD_etcd-minikube_kube-system_14e9e190fb437f166f99d456e822620c_0 1304235aa14e k8s.gcr.io/pause:3.6 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-apiserver-minikube_kube-system_dcc1d668a2ae9bf4dd040a9a8565027e_0
$
exit
# stop minikube ubuntu@dlp:~$ minikube stop * Stopping "minikube" in kvm2 ... * Node "minikube" stopped. # start minikube ubuntu@dlp:~$ minikube start * minikube v1.26.1 on Ubuntu 22.04 (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.24.3 on Docker 20.10.17 ... * 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 ubuntu@dlp:~$ minikube delete Deleting local Kubernetes cluster... Machine deleted. virsh list --all Id Name State -------------------------- |
Sponsored Link |