Create a single page document to experience kubernetes in minikube that can be followed sequentially and completed in a couple of hours.
Follow Installation document to install minikube and pre-requisite on your Windows, Linux or MacOS.
Start minikube
$ minikube start
π minikube v1.0.0 on linux (amd64)
π€Ή Downloading Kubernetes v1.14.0 images in the background ...
π‘ Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
π Restarting existing virtualbox VM for "minikube" ...
β Waiting for SSH access ...
πΆ "minikube" IP address is 192.168.99.100
π³ Configuring Docker as the container runtime ...
π³ Version of container runtime is 18.06.2-ce
β Waiting for image downloads to complete ...
β¨ Preparing Kubernetes environment ...
π Pulling images required by Kubernetes v1.14.0 ...
π Relaunching Kubernetes v1.14.0 using kubeadm ...
β Waiting for pods: apiserver proxy etcd scheduler controller dns
π― Updating kube-proxy configuration ...
π€ Verifying component health ......
π kubectl is now configured to use "minikube"
π Done! Thank you for using minikube!
Check status, version and minikube vitual machine IP
$ minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
$ minikube ip
192.168.99.100
$ minikube version
minikube version: v1.0.0
Check minikube logs. Useful to know minikube health - not user's code error.
$ minikube logs | head -5
==> coredns <==
.:53
2019-07-19T08:51:29.410Z [INFO] CoreDNS-1.3.1
2019-07-19T08:51:29.410Z [INFO] linux/amd64, go1.11.4, 6b56a9c
CoreDNS-1.3.1
$ minikube logs --problems
β Problems detected in "kube-addon-manager":
error: no objects passed to apply
minikube logs command shows logs of following componenets.
$ minikube logs |grep ^==
==> coredns <==
==> dmesg <==
==> kernel <==
==> kube-addon-manager <==
==> kube-apiserver <==
==> kube-proxy <==
==> kube-scheduler <==
==> kubelet <==
==> kubernetes-dashboard <==
==> storage-provisioner <==
What are addons minikube has?
$ minikube addons list
- addon-manager: enabled
- dashboard: enabled
- default-storageclass: enabled
- efk: disabled
- freshpod: disabled
- gvisor: disabled
- heapster: disabled
- ingress: disabled
- logviewer: disabled
- metrics-server: disabled
- nvidia-driver-installer: disabled
- nvidia-gpu-device-plugin: disabled
- registry: disabled
- registry-creds: disabled
- storage-provisioner: enabled
- storage-provisioner-gluster: disabled
Let's try to enable and then disable heapster (used to collect metrics). It is being replaced with metrics-server in a newer version of kubernetes
$ minikube addons enable heapster
β
heapster was successfully enabled
$ minikube addons disable heapster
β
heapster was successfully disabled
$
Login to minikube Linux VM. Check Linux Virtual machine hostname and IP. This is ip shown by minikube ip command
$ minikube ssh
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
# hostname
minikube
# cat /etc/os-release
NAME=Buildroot
VERSION=2018.05
ID=buildroot
VERSION_ID=2018.05
PRETTY_NAME="Buildroot 2018.05"
# ip addr show|grep -w inet
inet 127.0.0.1/8 scope host lo
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
inet 192.168.99.100/24 brd 192.168.99.255 scope global dynamic eth1
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
# ps -aef|grep kub|cut -c 1-140
....
truncated - these are components of kubernetes master and node
....
# kubelet --version
Kubernetes v1.14.0
Finally, see what other commands minikube offers usingminikube help
One cluster is not enough for you? Create one more. It will create a new VM in VirtualBox. Do it only if you have enough RAM Stop running minikube before creating a new one. The command creates a new VM, assign a new IP and configure kubectl CLI default setting to connect to the new cluster.
$ minikube stop
$ minikube start -p second-cluster
π minikube v1.0.0 on linux (amd64)
π€Ή Downloading Kubernetes v1.14.0 images in the background ...
π₯ Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
πΆ "second-cluster" IP address is 192.168.99.101
π³ Configuring Docker as the container runtime ...
π³ Version of container runtime is 18.06.2-ce
β Waiting for image downloads to complete ...
β¨ Preparing Kubernetes environment ...
π Pulling images required by Kubernetes v1.14.0 ...
π Launching Kubernetes v1.14.0 using kubeadm ...
β Waiting for pods: apiserver proxy etcd scheduler controller dns
π Configuring cluster permissions ...
π€ Verifying component health .....
π kubectl is now configured to use "second-cluster"
π Done! Thank you for using minikube!
$ minikube delete -p second-cluster
π₯ Deleting "second-cluster" from virtualbox ...
π The "second-cluster" cluster has been deleted.
$
Next, try to use set of kubectl commands to deploy a web server in kubernetes running inside minikube
minikube stop stops minikube.