※2021/01/16 podmanでも最新のコードから kind をビルドする事で、シングルノードは、稼働させる事はできたが、後で multinode が作成できない事に気づきました。
0. 前提
使用したOSは、CentOS Stream 8
です。
[root@centst8 ~]# cat /etc/redhat-release
CentOS Stream release 8
[root@centst8 ~]#
podman
のバージョンは、2.2.1
を使用しました。
[root@centst8 ~]# podman --version
podman version 2.2.1
[root@centst8 ~]#
一般ユーザーで動かそうとしましたが、Kind
の実行時にrootlessでは適切に動かない
とのpodman
のエラーが出たためrootless
モードは諦めroot
を使用しています。
[yuhki@centst8 ~]$ kind create cluster
enabling experimental podman provider
Creating cluster "kind" ...
podman provider does not work properly in rootless mode
[yuhki@centst8 ~]$
1. ツールのインストール
リリースされている kind
のバイナリをそのまま使うのであれば必要無いですが、今回はリリース版では上手く行かず、ソースから kind
を build
する事になったので、Go言語 をインストールします。
[root@centst8 ~]# dnf install -y go
[root@centst8 ~]# go version
go version go1.15.5 linux/amd64
[root@centst8 ~]#
kind
に必須ではありませんが、普通は使うと思うので、kubectl
もインストールして起きます。(参考:Install and Set Up kubectl)
[root@centst8 ~]# curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
[root@centst8 ~]# chmod +x ./kubectl
[root@centst8 ~]# sudo mv ./kubectl /usr/local/bin/kubectl # rootだからsudo 要らないけど。
[root@centst8 ~]# kubectl version --client
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.1", GitCommit:"c4d752765b3bbac2237bf87cf0b1c2e307844666", GitTreeState:"clean", BuildDate:"2020-12-18T12:09:25Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
[root@centst8 ~]#
2. kind をインストールする
2.1.上手く動か無かった手順
この記事作成時点で、上手く行かなかった手順(kind – Quick Startに書いてある手順)なので、読み飛ばして大丈夫です。
この手順を書いた時点で、kind
は、0.9.0
が最新版です。$HOME
直下に置いてます。
kind – Quick Start の通りにバイナリーをダウンロードしてパーミッションを与えます。
cd $HOME
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64
chmod +x ./kind
kind
のバイナリーへのパスを通します
export PATH=$PATH:~
kind create cluster
でクラスターを作ります。
がERROR: failed to create cluster: network details should only be one line, got 0 lines
というエラーがでました。
[root@centst8 ~]# kind create cluster
enabling experimental podman provider
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.19.1) 🖼
✓ Preparing nodes 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
ERROR: failed to create cluster: network details should only be one line, got 0 lines
[root@centst8 ~]#
なのでリリース版のkind
を使うのを諦めました。
2.2. 上手く動いた手順
もし kind の 0.9.0
をインストールしていたら、削除します。
delete kind
git からリポジトリをコピーして build します。$HOME直下にリポジトリをコピーしてしまいます。
cd $HOME
git clone https://github.com/kubernetes-sigs/kind
cd kind
make build
build
された、kind
のバイナリのパスを追加します。
export PATH=$PATH:~/kind/bin/
バージョンを確認。この記事の作成時点で、0.10.0-alpha+8ea030becbb6e0
[root@centst8 ~]# kind --version
kind version 0.10.0-alpha+8ea030becbb6e0
クラスターを作成してみると、今度は成功しました。
[root@centst8 ~]# kind create cluster
enabling experimental podman provider
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.19.4) 🖼
✓ Preparing nodes 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
Have a nice day! 👋
クラスターの作成を確認します。
[root@centst8 ~]# kind get clusters
enabling experimental podman provider
kind
[root@centst8 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kind-control-plane Ready master 34m v1.19.1
[root@centst8 ~]#