Skip to content

Instantly share code, notes, and snippets.

@digvijaybhakuni
Last active November 18, 2019 16:29
Show Gist options
  • Save digvijaybhakuni/a6a68110842aad146cbf7c7be252fc6e to your computer and use it in GitHub Desktop.
Save digvijaybhakuni/a6a68110842aad146cbf7c7be252fc6e to your computer and use it in GitHub Desktop.
k8s with minikube

Install Minikube

MacOS

sysctl -a | grep -E --color 'machdep.cpu.features|VMX' 

should 'VMX' display

minikube start

Create a deployment

# kubectl create deployment <name> --image=<image>

kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10

Expose deployment as service, the port 8080 will exprose from the deployment but service to outsite will be expose in different port

# kubectl expose deployment <name> --type=<type> --port=<port>
kubectl expose deployment hello-minikube --type=NodePort --port=8080

To get deployment or pod

kubectl get pod

To get service

kubectl get service

To get url port from service

# minikube service <name> --url
minikube service hello-minikube --url

To delete services

kubectl delete services hello-minikube

To delete deployment

kubectl delete deployment hello-minikube

To stop cluster

minikube stop

To dete cluster

minikube delete

Interacting with Your Cluster

Minikube sets this context to default automatically

kubectl config use-context minikube

This will open the dashboard

minikube dashboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment