Skip to content

jainishshah17/k8s_intro

Repository files navigation

Introduction to kubernetes

Install minikube

  • To check if virtulaization is supported on macOS, run the following command on your terminal.
sysctl -a | grep -E --color 'machdep.cpu.features|VMX' 

If you see VMX in the output (should be colored), the VT-x feature is enabled in your machine.

  • Install Minikube The easiest way to install Minikube on macOS is using Homebrew:
brew install minikube
  • Start minikube with hyperkit
minikube start --vm-driver=hyperkit
  • Check the status of the cluster:
minikube status
  • Check minikube version:
minikube version
  • Enable minikube dashboard:
minikube dashboard
  • Install kubectl:
brew install kubectl

kubectl version
  • Cluster information:
kubectl cluster-info
  • Create Nginx deployment
kubectl create deployment nginx --image=nginx:1.16.1
  • Check Deployment
kubectl get deployments
  • Check pods
kubectl get pods
  • Describe pod
kubectl describe pod $POD_NAME
  • Get pod logs
kubectl logs -f $POD_NAME
  • Exec into pod
kubectl exec -it $POD_NAME bash
  • Create service:
kubectl expose deployment/nginx --type="NodePort" --port 80
  • Get services:
kubectl get services
  • Get minikube IP
minikube ip
  • Get Replica sets
kubectl get rs
  • Scaling a deployment up
kubectl scale deployments/nginx --replicas=4
  • Scaling a deployment down
kubectl scale deployments/nginx --replicas=2
  • Rolling Update image
kubectl set image deployments/nginx nginx=nginx:1.17.9