Deploy multi nodes k8s cluster using minikube on win10
The minikube is single node cluster tool for test/dev purpose. The demand from community asked multi nodes cluster for long time, finally this experimental feature comes out, it seems working well so far.
Let’s test bit on win10.
install minikube on win10
download minikube-windows-amd64.exe from https://github.com/kubernetes/minikube/releases, then rename to minikube.exe, move to work folder dockertoolbox.
install kubectl on win10
Find latest stable kubectl for windows,
https://storage.googleapis.com/kubernetes-release/release/stable.txt
download it from link,
https://dl.k8s.io/release//bin/windows/amd64/kubectl.exe
move to work folder dockertoolbox.
start minikube cluster
start single node minikube cluster with default parameters,
minikube start
start two nodes minikube cluster with memory 2G each,
minikube start -n 2 --memory=2g
Here is sample log,
C:\dockertoolbox>minikube start -n 2 --memory=2g * minikube v1.23.1 on Microsoft Windows 10 Enterprise 10.0.18363 Build 18363 * Automatically selected the virtualbox driver * Starting control plane node minikube in cluster minikube * Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ... ! This VM is having trouble accessing https://k8s.gcr.io * To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/ * Preparing Kubernetes v1.22.1 on Docker 20.10.8 ... - Generating certificates and keys ... - Booting up control plane ... - Configuring RBAC rules ... * Configuring CNI (Container Networking Interface) ... - Using image gcr.io/k8s-minikube/storage-provisioner:v5 * Enabled addons: storage-provisioner, default-storageclass * Verifying Kubernetes components... * Starting node minikube-m02 in cluster minikube * Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ... * Found network options: - NO_PROXY=192.168.99.116 - no_proxy=192.168.99.116 ! This VM is having trouble accessing https://k8s.gcr.io * To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/ * Preparing Kubernetes v1.22.1 on Docker 20.10.8 ... - env NO_PROXY=192.168.99.116 * Verifying Kubernetes components... * Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
check minikube cluster status
From status we can see first minikube as Control Plane or master node, 2nd minikube-m02 as worker node, it looks great.
minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured minikube-m02 type: Worker host: Running kubelet: Running
stop minikube cluster
stop minikube cluster
minikube stop minikube status minikube type: Control Plane host: Stopped kubelet: Stopped apiserver: Stopped kubeconfig: Stopped minikube-m02 type: Worker host: Stopped kubelet: Stopped
check minikube cluster with kubectl
Using minikube kubectl
C:\dockertoolbox>minikube kubectl -- get nodes NAME STATUS ROLES AGE VERSION minikube Ready control-plane,master 6m3s v1.22.1 minikube-m02 Ready4m18s v1.22.1
or standalone kubectl,
C:\dockertoolbox>kubectl get nodes NAME STATUS ROLES AGE VERSION minikube Ready control-plane,master 6m10s v1.22.1 minikube-m02 Ready4m25s v1.22.1 C:\dockertoolbox>kubectl get po -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-78fcd69978-q66hx 1/1 Running 0 6m20s kube-system etcd-minikube 1/1 Running 0 6m32s kube-system kindnet-jzn52 1/1 Running 0 6m21s kube-system kindnet-qd9sr 1/1 Running 0 4m51s kube-system kube-apiserver-minikube 1/1 Running 0 6m35s kube-system kube-controller-manager-minikube 1/1 Running 0 6m32s kube-system kube-proxy-2sgsp 1/1 Running 0 6m21s kube-system kube-proxy-5bfhr 1/1 Running 0 4m51s kube-system kube-scheduler-minikube 1/1 Running 0 6m34s kube-system storage-provisioner 1/1 Running 0 6m31s
deploy on minikube cluster
C:\dockertoolbox>kubectl create deploy web --image=nginx --replicas=2 deployment.apps/web created C:\dockertoolbox>kubectl get po NAME READY STATUS RESTARTS AGE web-96d5df5c8-8sb9s 0/1 ContainerCreating 0 7s web-96d5df5c8-mg4rv 0/1 ContainerCreating 0 7s
scale up the deployment
C:\dockertoolbox>kubectl scale deploy web --replicas=10 deployment.apps/web scaled C:\dockertoolbox>kubectl get po -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES web-96d5df5c8-8bfjs 1/1 Running 0 28s 10.244.1.6 minikube-m02web-96d5df5c8-8sb9s 1/1 Running 0 63s 10.244.1.3 minikube-m02 web-96d5df5c8-9skd4 0/1 ContainerCreating 0 3s minikube web-96d5df5c8-ctrlf 1/1 Running 0 3s 10.244.1.7 minikube-m02 web-96d5df5c8-dbvnp 1/1 Running 0 28s 10.244.1.4 minikube-m02 web-96d5df5c8-hdv46 0/1 ContainerCreating 0 3s minikube-m02 web-96d5df5c8-kftf7 1/1 Running 0 28s 10.244.1.5 minikube-m02 web-96d5df5c8-mg4rv 1/1 Running 0 63s 10.244.1.2 minikube-m02 web-96d5df5c8-tbh2n 0/1 ContainerCreating 0 3s minikube-m02 web-96d5df5c8-xxcpt 0/1 ContainerCreating 0 3s minikube
We will see it deploys on two nodes.