⚙️

Minikube on M1 Mac

2022/09/25に公開

0. Prerequisite

  • Install Homebrew.
  • Install Docker Desktop for Apple silicon.

FYI:
https://brew.sh/
https://docs.docker.com/desktop/mac/apple-silicon/

Minikube on M1 Mac without Docker(with Podman)
https://zenn.dev/sbk0716/articles/d9235b78b97615

PC Info

  • Information on the PC used is as follows.
OS: macOS Monterey(v12.6)
Device: MacBook Pro (13-inch, M1, 2020)
Chip: Apple M1
Memory: 16GB

1. Check Homebrew and Docker version

% which brew
/opt/homebrew/bin/brew
% brew -v
Homebrew 3.6.2
Homebrew/homebrew-core (git revision 7cb0fad3396; last commit 2022-09-19)
% 
% which docker
/usr/local/bin/docker
% docker -v
Docker version 20.10.17, build 100c701
% 

2. Install Rosetta 2

FYI:
https://docs.docker.com/desktop/mac/apple-silicon/#system-requirements

% which softwareupdate
/usr/sbin/softwareupdate
% softwareupdate --install-rosetta --agree-to-license
...
...
Install of Rosetta 2 finished successfully
% 

3. Install kubectl with Homebrew on macOS

FYI:
https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/#install-with-homebrew-on-macos

% brew install kubectl
...
...
% which kubectl
/opt/homebrew/bin/kubectl
% 

4. Install minikube with Homebrew on macOS

FYI:
https://minikube.sigs.k8s.io/docs/start/

% brew install minikube
...
...
% which minikube
/opt/homebrew/bin/minikube
% minikube version
minikube version: v1.27.0
commit: 4243041b7a72319b9be7842a7d34b6767bbdac2b
% 

If the Docker Service has not been started beforehand, an error will occur when executing the command.

5. minikube start with docker driver

  • If the docker daemon is not running, an error occurs when executing the minikube start command.

FYI:
https://kubernetes.io/ja/docs/setup/learning-environment/minikube/

% minikube start --driver=docker
😄  minikube v1.27.0 on Darwin 12.6 (arm64)
❗  Kubernetes 1.25.0 has a known issue with resolv.conf. minikube is using a workaround that should work for most use cases.
❗  For more information, see: https://github.com/kubernetes/kubernetes/issues/112135
✨  Using the docker driver based on user configuration
📌  Using Docker Desktop driver with root privileges
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
💾  Downloading Kubernetes v1.25.0 preload ...
    > preloaded-images-k8s-v18-v1...:  320.78 MiB / 320.78 MiB  100.00% 2.28 Mi
    > gcr.io/k8s-minikube/kicbase:  348.00 MiB / 348.00 MiB  100.00% 2.21 MiB p
    > gcr.io/k8s-minikube/kicbase:  0 B [______________________] ?% ? p/s 1m31s
🔥  Creating docker container (CPUs=2, Memory=4000MB) ...
🐳  Preparing Kubernetes v1.25.0 on Docker 20.10.17 ...
    ▪ 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
% 
% kubectl version --output=yaml
clientVersion:
  buildDate: "2022-09-14T19:40:59Z"
  compiler: gc
  gitCommit: e4d4e1ab7cf1bf15273ef97303551b279f0920a9
  gitTreeState: clean
  gitVersion: v1.25.1
  goVersion: go1.19.1
  major: "1"
  minor: "25"
  platform: darwin/arm64
kustomizeVersion: v4.5.7
serverVersion:
  buildDate: "2022-08-23T17:38:15Z"
  compiler: gc
  gitCommit: a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2
  gitTreeState: clean
  gitVersion: v1.25.0
  goVersion: go1.19
  major: "1"
  minor: "25"
  platform: linux/arm64

% 
% kubectl get namespace
NAME              STATUS   AGE
default           Active   113s
kube-node-lease   Active   115s
kube-public       Active   115s
kube-system       Active   115s
% 
% kubectl get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   45s   v1.25.0
% 
% kubectl get pods -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS      AGE
kube-system   coredns-565d847f94-x5zw2           1/1     Running   0             108s
kube-system   etcd-minikube                      1/1     Running   0             2m2s
kube-system   kube-apiserver-minikube            1/1     Running   0             2m4s
kube-system   kube-controller-manager-minikube   1/1     Running   0             2m3s
kube-system   kube-proxy-wl8mw                   1/1     Running   0             109s
kube-system   kube-scheduler-minikube            1/1     Running   0             2m2s
kube-system   storage-provisioner                1/1     Running   1 (78s ago)   2m1s
% kubectl get services -A
NAMESPACE     NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
default       kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP                  2m23s
kube-system   kube-dns     ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   2m22s
% 

Discussion