minikubeのインストール

  • Ubuntu 18.04
  • VMスペック
    • RAM: 2GB
    • CPU: v2Core
    • SSD: 30GB
  • minikube v1.22.0
  • docker v20.10.2

手順

アップデート

sudo apt update

dockerのインストール

sudo apt install docker.io

Minikubeのインストール

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb

一般ユーザからdockerを使えるように

sudo usermod -aG docker $USER
## ログアウトして再ログイン
## sudoなしでdockerコマンドが使えるかチェック

Minikubeを起動

koyama@koyama-k8s:~$ minikube start
* minikube v1.22.0 on Ubuntu 18.04
* Automatically selected the docker driver. Other choices: none, ssh

X The requested memory allocation of 1993MiB does not leave room for system overhead (total system memory: 1993MiB). You may face stability issues.
* Suggestion: Start minikube with less memory allocated: 'minikube start --memory=1993mb'

* Starting control plane node minikube in cluster minikube
* Pulling base image ...
* Downloading Kubernetes v1.21.2 preload ...
    > preloaded-images-k8s-v11-v1...: 502.14 MiB / 502.14 MiB  100.00% 46.37 Mi
    > gcr.io/k8s-minikube/kicbase...: 361.09 MiB / 361.09 MiB  100.00% 9.41 MiB
* Creating docker container (CPUs=2, Memory=1993MB) ...
* Preparing Kubernetes v1.21.2 on Docker 20.10.7 ...
  - 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: default-storageclass, storage-provisioner
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

起動状態を確認する.RunningとReadyが表示されているか確かめる.

koyama@koyama-k8s:~$ minikube status
minikube
type: Control Plane
host: Running ←ここ
kubelet: Running ←ここ
apiserver: Running ←ここ
kubeconfig: Configured

koyama@koyama-k8s:~$ kubectl get no
NAME       STATUS   ROLES                  AGE    VERSION
minikube   Ready ←ここ   control-plane,master   2m7s   v1.21.2

メモリ指定して起動する場合

minikube delete  # 一度minikubeを消す
minikube start --memory=2000mb --cpus=2  # 再作成

参考資料