1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

kind で podman を使用する

Last updated at Posted at 2021-01-09

※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のバイナリをそのまま使うのであれば必要無いですが、今回はリリース版では上手く行かず、ソースから kindbuild する事になったので、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 ~]# 
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?