概要
学習用でk8sを立てている時に以前立てた方法では立てれなくなっていた
結論から言うとメモリが2GBは必要となった
前はt3.microで立てれたが、今はt3.mediumにする必要がある
t3.microで立てている記事が多いため展開
実行詳細
EC2スペック
項目 | 概要 |
---|---|
AMI | Ubuntu Server 18.04 LTS (HVM), SSD Volume Type |
Instance Type | t3.micro (2 vCPU, 1GB Memory) |
Storage | 8 GB (gp2) |
使用セットアップコマンド
$ curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin/kubectl
$ sudo apt-get update && \
sudo apt-get install docker.io -y
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
# 最新のバージョンだと下記のコマンドも必要
$ sudo apt-get install -y conntrack
minikubeエラー
$ sudo minikube start --vm-driver=none
😄 minikube v1.12.3 on Ubuntu 18.04
✨ Using the none driver based on user configuration
❗ Your system has only 953MB memory. This might not work minimum required is 2000MB.
💣 Sorry, Kubernetes 1.18.3 requires conntrack to be installed in root's path
t3.microはメモリが1GBのため、メモリ不足とのこと
使用メモリが2GBからとなっているためt3.mediumにする必要がある
使用メモリが2GB??
t3.smallでええやんと思ったそこのあなた
t3.smallだと以下のエラーが出てクラッシュするよ
$ sudo minikube start --vm-driver=none
😄 minikube v1.12.3 on Ubuntu 18.04
✨ Using the none driver based on user configuration
❗ Your system has only 1949MB memory. This might not work minimum required is 2000MB.
❗ Requested memory allocation (1949MB) is less than the recommended minimum 2000MB. Kubernetes may crash unexpectedly.
❗ You are allocating 1949MB to memory and your system only has 1949MB. You might face issues. try specifying a lower memory:
miniube start --memory=974.5mb
👍 Starting control plane node minikube in cluster minikube
🤹 Running on localhost (CPUs=2, Memory=1949MB, Disk=7876MB) ...
ℹ️ OS release is Ubuntu 18.04.5 LTS
🐳 Preparing Kubernetes v1.18.3 on Docker 19.03.6 ...
▪ kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
> kubeadm.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
> kubectl.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
> kubelet.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
> kubectl: 41.99 MiB / 41.99 MiB [---------------] 100.00% 40.57 MiB p/s 1s
> kubeadm: 37.97 MiB / 37.97 MiB [---------------] 100.00% 25.68 MiB p/s 2s
> kubelet: 108.04 MiB / 108.04 MiB [-------------] 100.00% 40.74 MiB p/s 3s
🤹 Configuring local host environment ...
❗ The 'none' driver is designed for experts who need to integrate with an existing VM
💡 Most users should use the newer 'docker' driver instead, which does not require root!
📘 For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/none/
❗ kubectl and minikube configuration will be stored in /home/ubuntu
❗ To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:
▪ sudo mv /home/ubuntu/.kube /home/ubuntu/.minikube $HOME
▪ sudo chown -R $USER $HOME/.kube $HOME/.minikube
💡 This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
🔎 Verifying Kubernetes components...
🌟 Enabled addons: default-storageclass, storage-provisioner
🏄 Done! kubectl is now configured to use "minikube"
ギリギリ足りないらしい…
t3.mediumの場合は問題なく動作します