Minikube : Install2020/08/05 |
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. Also it's possible to configure Kubernetes Cluster without any Hypervisor, then refer to the next page. |
root@dlp:~# apt -y install qemu-kvm libvirt-daemon-system libvirt-daemon bridge-utils
|
[2] | Install Minikube and other required tools. |
# install kubectl root@dlp:~# snap install kubectl --classic kubectl 1.18.6 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.12.1 commit: 5664228288552de9f3a446ea4f51c6f29bbdd0e0-dirty |
[3] | Start Minikube with a common user. |
ubuntu@dlp:~$ minikube start --vm-driver=kvm2 * minikube v1.12.1 on Ubuntu 20.04 * Using the kvm2 driver based on user configuration * Downloading VM boot image ... > minikube-v1.12.0.iso.sha256: 65 B / 65 B [-------------] 100.00% ? p/s 0s > minikube-v1.12.0.iso: 173.57 MiB / 173.57 MiB [] 100.00% 46.88 MiB p/s 3s * Starting control plane node minikube in cluster minikube * Downloading Kubernetes v1.18.3 preload ... > preloaded-images-k8s-v4-v1.18.3-docker-overlay2-amd64.tar.lz4: 526.27 MiB * Creating kvm2 VM (CPUs=2, Memory=2900MB, Disk=20000MB) ... * Preparing Kubernetes v1.18.3 on Docker 19.03.12 ... * Verifying Kubernetes components... * Enabled addons: default-storageclass, storage-provisioner * Done! kubectl is now configured to use "minikube" # show status ubuntu@dlp:~$ minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured 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.80: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 master is running at https://192.168.39.80:8443 KubeDNS is running at https://192.168.39.80: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 master 2m17s v1.18.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 1c5aee338690 4689081edb10 "/storage-provisioner" 2 minutes ago Up 2 minutes k8s_storage-provisioner_storage-provisioner_kube-system_77ed9083-d466-4b02-a695-7a11824e1d27_0 25eb2594fc76 k8s.gcr.io/pause:3.2 "/pause" 2 minutes ago Up 2 minutes k8s_POD_storage-provisioner_kube-system_77ed9083-d466-4b02-a695-7a11824e1d27_0 6e544344ef92 67da37a9a360 "/coredns -conf /etc…" 2 minutes ago Up 2 minutes k8s_coredns_coredns-66bff467f8-wmj9f_kube-system_4a02a39c-778f-4d93-87da-8ef7e809db43_0 ec1f4b2a5655 k8s.gcr.io/pause:3.2 "/pause" 2 minutes ago Up 2 minutes k8s_POD_coredns-66bff467f8-wmj9f_kube-system_4a02a39c-778f-4d93-87da-8ef7e809db43_0 b082710f8612 3439b7546f29 "/usr/local/bin/kube…" 2 minutes ago Up 2 minutes k8s_kube-proxy_kube-proxy-cj5mk_kube-system_39670b01-b375-44f5-8b43-a01b455ce3cd_0 79a17ee8836e k8s.gcr.io/pause:3.2 "/pause" 2 minutes ago Up 2 minutes k8s_POD_kube-proxy-cj5mk_kube-system_39670b01-b375-44f5-8b43-a01b455ce3cd_0 5a59f1697877 303ce5db0e90 "etcd --advertise-cl…" 3 minutes ago Up 3 minutes k8s_etcd_etcd-minikube_kube-system_3ed97ae4e9a452c90b0e8dc4b54ce717_0 6647edb3679d 7e28efa976bd "kube-apiserver --ad…" 3 minutes ago Up 3 minutes k8s_kube-apiserver_kube-apiserver-minikube_kube-system_a571f357d1dc95a53069cd324d44eabe_0 7a367e3f91bd da26705ccb4b "kube-controller-man…" 3 minutes ago Up 3 minutes k8s_kube-controller-manager_kube-controller-manager-minikube_kube-system_ba963bc1bff8609dc4fc4d359349c120_0 3837d24e174d 76216c34ed0c "kube-scheduler --au…" 3 minutes ago Up 3 minutes k8s_kube-scheduler_kube-scheduler-minikube_kube-system_dcddbd0cc8c89e2cbf4de5d3cca8769f_0 5135b9fcc194 k8s.gcr.io/pause:3.2 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-scheduler-minikube_kube-system_dcddbd0cc8c89e2cbf4de5d3cca8769f_0 adf2c5388b04 k8s.gcr.io/pause:3.2 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-controller-manager-minikube_kube-system_ba963bc1bff8609dc4fc4d359349c120_0 0e0a6efd9e7a k8s.gcr.io/pause:3.2 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-apiserver-minikube_kube-system_a571f357d1dc95a53069cd324d44eabe_0 411e9ff0a85e k8s.gcr.io/pause:3.2 "/pause" 3 minutes ago Up 3 minutes k8s_POD_etcd-minikube_kube-system_3ed97ae4e9a452c90b0e8dc4b54ce717_0
$
exit
# stop minikube ubuntu@dlp:~$ minikube stop * Stopping "minikube" in kvm2 ... * Node "minikube" stopped. # start minikube ubuntu@dlp:~$ minikube start * minikube v1.12.1 on Ubuntu 20.04 * 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.18.3 on Docker 19.03.12 ... * Verifying Kubernetes components... * Enabled addons: default-storageclass, storage-provisioner * Done! kubectl is now configured to use "minikube" # remove minikube ubuntu@dlp:~$ minikube delete Deleting local Kubernetes cluster... Machine deleted. virsh list --all Id Name State -------------------------- |
Sponsored Link |
|