Friday, September 27, 2019

single node k8s cluster using Minikube

$ minikube version
minikube version: v1.2.0
$ minikube start
* minikube v1.2.0 on linux (amd64)
* Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
* Configuring environment for Kubernetes v1.15.0 on Docker 18.09.5
  - kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
kubectl cluster-info
* Pulling images ...
* Launching Kubernetes ...
* Configuring local host environment ...
* Verifying: apiserver proxy etcd scheduler controller dns
* Done! kubectl is now configured to use "minikube"
$ kubectl cluster-info
Kubernetes master is running at https://172.17.0.21:8443
KubeDNS is running at https://172.17.0.21:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
$ kubectl cluster-info
Kubernetes master is running at https://172.17.0.21:8443
KubeDNS is running at https://172.17.0.21:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
$ kubectl get nodes
NAME       STATUS   ROLES    AGE     VERSION
minikube   Ready    master   3m37s   v1.15.0
$ kubectl create deployment first-deployment --image=katacoda/docker-http-server
deployment.apps/first-deployment created
$ kubectl get pods
NAME                               READY   STATUS              RESTARTS   AGE
first-deployment-8cbf74484-6lwkz   0/1     ContainerCreating   0          1s
$ kubectl expose deployment first-deployment --port=80 --type=NodePort
service/first-deployment exposed
$ export PORT=$(kubectl get svc first-deployment -o go-template='{{range.spec.ports}}{{if .nodePort}}{{.nodePort}}{{"\n"}}{{end}}{{end}}')
$ echo "Accessing host01:$PORT"
Accessing host01:31346
$ curl host01:$PORT

This request was processed by host: first-deployment-8cbf74484-6lwkz


$ minikube addons enable dashboard
* dashboard was successfully enabled
$ kubectl apply -f /opt/kubernetes-dashboard.yaml
service/kubernetes-dashboard-katacoda created
$ kubectl get pods -n kube-system  -w
NAME                               READY   STATUS    RESTARTS   AGE
coredns-5c98db65d4-b974n           1/1     Running   1          3m43s
coredns-5c98db65d4-dphwd           1/1     Running   1          3m43s
etcd-minikube                      1/1     Running   0          2m44s
kube-addon-manager-minikube        1/1     Running   0          2m51s
kube-apiserver-minikube            1/1     Running   0          2m43s
kube-controller-manager-minikube   1/1     Running   0          2m47s
kube-proxy-8crjj                   1/1     Running   0          3m43s
kube-scheduler-minikube            1/1     Running   0          2m45s
storage-provisioner                1/1     Running   0          3m41s

kubernetes-dashboard-7b8ddcb5d6-tpq7f   0/1     Pending   0          0s
kubernetes-dashboard-7b8ddcb5d6-tpq7f   0/1     Pending   0          0s
kubernetes-dashboard-7b8ddcb5d6-tpq7f   0/1     ContainerCreating   0          0s
kubernetes-dashboard-7b8ddcb5d6-tpq7f   1/1     Running             0          2s

No comments:

Post a Comment