Steps to install kubernetes on Mac m1:
- Install docker on mac (m1) from the link. Run docker.
- Install minikube. minikube lets you run Kubernetes on your local computer
brew install minikube
- Start minikube cluster (minikube detailed documentation)
minikube start
minikube v1.28.0 on Darwin 12.6 (arm64) ✨ Automatically selected the docker driver 📌 Using Docker Desktop driver with root privileges 👍 Starting control plane node minikube in cluster minikube 🚜 Pulling base image ... 🔥 Creating docker container (CPUs=2, Memory=7803MB) ... 🐳 Preparing Kubernetes v1.25.3 on Docker 20.10.20 ... ▪ Generating certificates and keys ... ▪ Booting up control plane ... ▪ Configuring RBAC rules ... 🔎 Verifying Kubernetes components... ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5 🌟 Enabled addons: storage-provisioner, default-storageclass 🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
- This will create a minikube cluster in docker as shown below
- Install kubectl
brew install kubectl - Check kubectl version
kubectl version --client --output=yaml
- Check cluster info using kubectl
kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:50303 CoreDNS is running at https://127.0.0.1:50303/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
- Get kubectl config (this is configured when cluster is created to set default context for cluster)
kubectl config view
- Change default context for kubectl command
kubectl config use-context minikube
( Use kubectl config current-context to see current context) - List all pods on a specific namespace (use -A for all namespaces)
kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE coredns-565d847f94-52kkd 1/1 Running 0 2m58s etcd-minikube 1/1 Running 0 3m11s kube-apiserver-minikube 1/1 Running 0 3m13s kube-controller-manager-minikube 1/1 Running 0 3m12s kube-proxy-64pwk 1/1 Running 0 2m58s kube-scheduler-minikube 1/1 Running 0 3m13s storage-provisioner 1/1 Running 1 (2m27s ago) 3m10s
- See all namespaces
kubectl get namespace
- View minikube kebernetes dashboard
minikube dashboard
(For specific profile use: minikube dashboard –profile minikube2) - Alternate to minikube dashboard (which also uses proxy), we can also run
kubectl proxy
kubectl proxy --port=8001
and visithttp://127.0.0.1:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
- To delete minikube cluster
minikube delete
(use –all to delete all clusters)