kubernetes
1 $ minikube version
2 minikube version: v1.2.0
3 $ minikube start
4 * minikube v1.2.0 on linux (amd64)
5 * Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
6 * Configuring environment for Kubernetes v1.15.0 on Docker 18.09.5
7 - kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
8 * Pulling images ...
9 * Launching Kubernetes ...
10
11 * Configuring local host environment ...
12 * Verifying: apiserver proxy etcd scheduler controller dns
13 * Done! kubectl is now configured to use "minikube"
cluster details and health status
1 $ kubectl cluster-info
2 Kubernetes master is running at https://172.17.0.30:8443
3 KubeDNS is running at https://172.17.0.30:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
4
5 To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
get cluster nodes
1 $ kubectl get nodes
2 NAME STATUS ROLES AGE VERSION
3 minikube Ready master 3m1s v1.15.0
deploy containers
# deploy container
$ kubectl create deployment first-deployment --image=katacoda/docker-http-server
deployment.apps/first-deployment created
$ # deploy container in cluster
# check pods
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
first-deployment-8cbf74484-s2fkl 1/1 Running 0 25s
# expose deployment
$ kubectl expose deployment first-deployment --port=80 --type=NodePort
service/first-deployment exposed
$ kubectl get svc first-deployment
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
first-deployment NodePort 10.98.246.87 <none> 80:31219/TCP 105s
# do request to port 80 in cluster ip
$ curl 10.98.246.87:80
<h1>This request was processed by host: first-deployment-8cbf74484-s2fkl</h1>
$curl host01:31219
<h1>This request was processed by host: first-deployment-8cbf74484-s2fkl</h1>
dashboard
$ minikube addons enable dashboard
#The Kubernetes dashboard allows you to view your applications
in a UI.
* dashboard was successfully enabled
$ kubectl apply -f /opt/kubernetes-dashboard.yaml
# only in katacoda
service/kubernetes-dashboard-katacoda created
# check progress
$ kubectl get pods -n kube-system -w #check progress
NAME READY STATUS RESTARTS AGE
coredns-5c98db65d4-b2kxm 1/1 Running 0 17m
coredns-5c98db65d4-mm567 1/1 Running 1 17m
etcd-minikube 1/1 Running 0 16m
kube-addon-manager-minikube 1/1 Running 0 16m
kube-apiserver-minikube 1/1 Running 0 16m
kube-controller-manager-minikube 1/1 Running 0 16m
kube-proxy-pngm9 1/1 Running 0 17m
kube-scheduler-minikube 1/1 Running 0 16m
kubernetes-dashboard-7b8ddcb5d6-xt5nt 1/1 Running 0 76s
storage-provisioner 1/1 Running 0 17m
^C$
# dashboard url https://2886795294-30000-kitek05.environments.katacoda.com/
# how to launch a Single Node Kubernetes cluster.