MiniKube

$ minikube start

$ minikube status

$ minikube ssh
    
$ kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080

$ kubectl expose deployment hello-minikube --type=NodePort

$ kubectl get pod

$ kubectl describe pod name

$ curl $(minikube service hello-minikube --url)

$ minikube stop
$ minikube dashboard

$ minikube ip

PersistentVolume:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0001
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 5Gi
  hostPath:
    path: /data/pv0001/
$ minikube start --docker-env HTTP_PROXY=http://$YOURPROXY:PORT \
                 --docker-env HTTPS_PROXY=https://$YOURPROXY:PORT

create pod

$ kubectl create -f http://k8s.io/docs/tasks/configure-pod-container/pod-redis.yaml

$ kubectl get --watch pod redis

$ kubectl exec -it redis -- /bin/bash

# docker run:
# start the pod running nginx
$ kubectl run --image=nginx nginx-app --port=80 --env="DOMAIN=cluster"

# expose a port through with a service
$ kubectl expose deployment nginx-app --port=80 --name=nginx-http

# docker ps
$ kubectl get po

# docker attach
$ kubectl attach -it nginx-app-5jyvm

# docker exec
$ kubectl exec nginx-app-5jyvm -- cat /etc/hostname

# docker logs
$ kubectl logs -f nginx-app-zibvs

by default pods will not terminate if their processes exit. Instead it will restart the process. This is similar to the docker run option –restart=always with one major difference. In docker, the output for each invocation of the process is concatenated but for Kubernetes, each invocation is separate.

$ kubectl logs --previous nginx-app-zibvs

# docker stop and docker rm

$ kubectl get deployment nginx-app
$ kubectl get po -l run=nginx-app
$ kubectl delete deployment nginx-app
$ kubectl get po -l run=nginx-app

# docker info
$ kubectl cluster-info
Search Blog: