前書き
Mac mini M4を新たに導入したのでKubernetesの開発環境を整備しようと思いました。
先人の智慧を活用してmultipassを利用して環境を作ろうと思いましたが、mutipassが起動しない状況だったのでたの方法を模索した際のメモです。
PodmanのインストールとPodman machineの作成
brew install podman
podman machine init --cpus=4 --memory=8096 --disk-size=50
~/.config/containers/containers.confにhelper_binaries_dirを設定する
[engine]
helper_binaries_dir = ["/opt/homebrew/Cellar/podman/5.3.1/bin","/opt/homebrew/Cellar/podman/5.3.1/libexec"]
gvproxyがないと怒られる
この状態でpodman machine startするとgvproxyが無いと怒られる。
からgvproxy-darwinをダウンロードしてpodmanのバイナリと同じ場所に配置してあげる
mv gvproxy-darwin /opt/homebrew/Cellar/podman/5.3.1/bin/gvproxy
chmod 755 /opt/homebrew/Cellar/podman/5.3.1/bin/gvproxy
podman machine start
podman system connection default podman-machine-default-root
export DOCKER_HOST='unix:///var/folders/04/3p3cfcms3134k04jgcvzw3jm0000gn/T/podman/podman-machine-default-api.sock'
※DOCKER_HOSTに設定する値はpodman machine start 時に表示された値
kubectlとkindをインストールする
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"
chmod 755 kubectl
sudo mv kubectl /usr/local/bin/.
sudo chown root: /usr/local/bin/kubectl
brew install kind
Knativeをインストール、kindクラスタ作成、サンプルサービスの動作確認をする
brew install knative/client/kn
brew install knative-extensions/kn-plugins/quickstart
export KIND_EXPERIMENTAL_PROVIDER=podman
kubernetesVersion="v1.32.0"
kind create cluster --config=<(echo "---
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: knative
networking:
apiServerAddress: "0.0.0.0"
nodes:
- role: control-plane
image: kindest/node:$kubernetesVersion
extraPortMappings:
- containerPort: 31080
listenAddress: 0.0.0.0
hostPort: 80
")
kubeconfigを修正
sed -i '' 's/https:\/\/:/https:\/\/localhost:/g' ~/.kube/config
knativeをQuickstartで起動してサンプルを起動
kn quickstart kind --name knative
kn service create hello \
--image gcr.io/knative-samples/helloworld-go \
--port 8080 \
--env TARGET=World \
--revision-name=world
curl http://hello.default.127.0.0.1.sslip.io
Hello World!
いったん、ここまで