Requirement
- AlmaLinux release 9.7
- Intel CPU (本環境は Hyper-V 環境で確認)
- Memory: 8GB
- Storage: 128GB
Install Docker
Docker公式のリポジトリをインポートして有効にします。
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
Docker をインストールします。
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
ユーザーアカウントで docker を使用できるように設定します。
sudo usermod -aG docker $USER
ユーザーアカウントで docker を実行できるように usermod の後に、一度 ログアウトして再度ログインします。
システム起動時に自動的に docker が起動するように設定します。
sudo systemctl enable --now docker
確認のため hallo-world を実行して、Docker のインストールを確認します。
docker run hello-world
Install kubectl
sudo curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo mv kubectl /usr/local/bin/
sudo chmod +x /usr/local/bin/kubectl
Install minikube
公式ドキュメント https://minikube.sigs.k8s.io/docs/start/?arch=%2Flinux%2Fx86-64%2Fstable%2Fbinary+download に従ってインストールします。
sudo curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
sudo rpm -Uvh minikube-latest.x86_64.rpm
インストールした minikube のバージョンを確認します。
$ minikube version
minikube version: v1.37.0
commit: 65318f4cfff9c12cc87ec9eb8f4cdd57b25047f3
Install helm
公式ドキュメント https://helm.sh/docs/intro/install/ に従いインストールします。
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4
chmod 700 get_helm.sh
./get_helm.sh
Execute minikube
minikube を実行するときには docker ドライバーを指定して以下のように実行します。
$ minikube start --driver=docker --memory=3072mb
😄 minikube v1.37.0 on Ubuntu 24.04 (hyperv/amd64)
✨ Using the docker driver based on user configuration
🧯 The requested memory allocation of 3072MiB does not leave room for system overhead (total system memory: 3868MiB). You may face stability issues.
💡 Suggestion: Start minikube with less memory allocated: 'minikube start --memory=3072mb'
📌 Using Docker driver with root privileges
👍 Starting "minikube" primary control-plane node in "minikube" cluster
🚜 Pulling base image v0.0.48 ...
💾 Downloading Kubernetes v1.34.0 preload ...
...
minikube を停止するには、以下のコマンドを実行します。
minikube stop
起動の確認ができたら、システムが起動したらすぐに使えるように systemd の設定をします。
minikube を systemd で管理するために、minikube.service を作成します。
以下の username の部分を、docker管理とminikubeを管理するアカウント名に置き換えます。
vi /etc/systemd/system/minikube.service
[Unit]
Description=Minikube Cluster
After=containerd.service docker.service
[Service]
Type=oneshot
ExecStart=/usr/bin/minikube start --driver=docker
RemainAfterExit=true
ExecStop=/usr/bin/minikube stop
StandardOutput=journal
User=username
Group=docker
[Install]
WantedBy=multi-user.target
minikube.service を作成したら、システムに読み込み起動の設定をします。
sudo systemctl daemon-reload
sudo systemctl enable --now minikube