How to install minikube on Mac

Install a hypervisor & minikube and start it

junsoo bae
2 min readMay 3, 2021
$ brew update
$ brew install hyperkit
$ brew install minikube
$ minikube start --vm-driver=hyperkit

Get status

$ kubectl get nodes
$ minikube status
$ kubectl get pod
$ kubectl get services

Create pod

Deployment > ReplicaSet > Pod is an abstraction of Container

# deploy a nginx image (blueprint for creating pods)
$ kubectl create deployment nginx-depl --image=ngnix
# get deployment
$ kubectl get deployment
$ kubectl get pod
$ kubectl get pod -o wide
$ kubectl get replicaset
# delete pods, deployments
$ kubectl delete deploy nginx-depl
$ kubectl delete pods --all
# edit deployment
$ kubectl edit deployment nginx-depl
# log
$ kubectl logs [pod-name]
$ kubectl describe pod [pod-name]
# debugging - get the terminal
$ kubectl exec -it [pod-name] -- bin/bash

apply configuration file (nginx-deployment.yaml)

-- nginx-deployment.yaml fileapiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
selector:
matchLabels:
app: nginx
replicas: 2 # tells deployment to run 1 pods matching the template
template: # create pods using pod definition in this template
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 8080
$ kubectl apply -f nginx-deployment.yaml
$ kubectl delete -f [file name]

nginx-service.yaml

apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 8080
image: nginxports:- containerPort: 8080$ kubectl apply -f nginx-service.yaml
$ kubectl describe service nginx-service
$ kubectl get pod -o wide

--

--