There are several tools to setup Vanilla Kubernetes, like kubeadm, minikube, Kubespray, while minikube is to setup Vanilla Kubernetes locally, focusing on making it easy to learn and develop for Kubernetes.
# start k8s cluster $ minikube start # for china use this one $ sudo minikube start --driver=none --extra-config=kubeadm.ignore-preflight-errors=NumCPU --force --image-mirror-country=cn
$ minikube pause $ minikube stop
$ minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured timeToStop: Nonexistent
$ minikube delete --all
$ minikube addons list
# enable ingress plugin $ minikube addons enable ingress The 'ingress' addon is enabled.
# after ingress is enabled, an ingress pod is running listen on 80 by nginx # and meanwhile docker-proxy starts as well on the node which ingress pod runs. # so that if you access that node on port 80, it will proxy the traffic to ingress container # which performs ingress rules and selects the proper endpoint
$ kubectl cluster-info Kubernetes control plane is running at https://10.116.5.201:8443 KubeDNS is running at https://10.116.5.201:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy # after cluster starts, check or deploy pod, service $ kubectl get po -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-54d67798b7-f6wq8 1/1 Running 0 11h kube-system etcd-dev 1/1 Running 0 11h kube-system kube-apiserver-dev 1/1 Running 0 11h kube-system kube-controller-manager-dev 1/1 Running 0 11h kube-system kube-proxy-fsd9r 1/1 Running 0 11h kube-system kube-scheduler-dev 1/1 Running 0 11h kube-system storage-provisioner 0/1 ImagePullBackOff 0 11h
# Create a sample deployment and expose it on port 8080: $ kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4 $ kubectl expose deployment hello-minikube --type=NodePort --port=8080
# check service $ kubectl get services hello-minikube
# map to host port 7080 $ kubectl port-forward service/hello-minikube 7080:8080 $ curl http://localhost:7080/
# run minikube command with more logs for troubleshooting $ minikube addons enable dashboard $ minikube addons enable metrics-server # if pod is not ready due to pull image error like this $ kubectl get po -n kubernetes-dashboard --show-labels NAME READY STATUS RESTARTS AGE LABELS dashboard-metrics-scraper-8554f74445-rnq6d 0/1 ImagePullBackOff 0 15m k8s-app=dashboard-metrics-scraper,pod-template-hash=8554f74445 kubernetes-dashboard-6c87f58d7c-48gk7 0/1 ImagePullBackOff 0 15m gcp-auth-skip-secret=true,k8s-app=kubernetes-dashboard,pod-template-hash=6c87f58d7c
# change the image for these pods # registry.cn-hangzhou.aliyuncs.com/lxm-k8s/metrics-scraper:v1.0.6 # registry.cn-hangzhou.aliyuncs.com/lixunan/kubernetes-dashboard:v2.1.0 $ sudo kubectl set image deploy kubernetes-dashboard kubernetes-dashboard=registry.cn-hangzhou.aliyuncs.com/lixunan/kubernetes-dashboard:v2.1.0 -n kubernetes-dashboard
$ sudo kubectl set image deploy dashboard-metrics-scraper dashboard-metrics-scraper=registry.cn-hangzhou.aliyuncs.com/lxm-k8s/metrics-scraper:v1.0.6 -n kubernetes-dashboard
# local access from this machine $ minikube dashboard 🤔 Verifying dashboard health ... 🚀 Launching proxy ... 🤔 Verifying proxy health ... http://127.0.0.1:43909/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
# remote access by proxy, all interfaces $ sudo kubectl proxy --address='0.0.0.0' --disable-filter=true # http://10.117.5.21:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/overview?namespace=default
$ kubectl get po -n kubernetes-dashboard --show-labels $ kubectl describe po -l k8s-app=kubernetes-dashboard -n kubernetes-dashboard $ kubectl logs -l k8s-app=kubernetes-dashboard -n kubernetes-dashboard