のべラボ.blog

Tech Blog | AWS や サーバーレスやコンテナ などなど

eksctl で Kubernetes 1.23 の Amazon EKS クラスターを作成する

2022年8月11日に、Amazon Elastic Kubernetes Service ( Amazon EKS ) で Kubernetes のバージョン 1.23 がサポートされました。

aws.amazon.com

そこで、早速 バージョン 1.23 の EKS クラスターを作成しようと思ったのですが、その時点ではまだ eksctl が対応していないことが判明しました。

1.23 のサポートがアナウンスされた後に、eksctl のバージョンはアップグレードしたのですが、次のように、eksctl のバージョンが 1.0.8 以下の場合、eksctl で EKS クラスターを作成しようとすると指定バージョンが対象外であるとエラーになります。

$ eksctl version
0.108.0
$ eksctl create cluster \
> --name test123-cluster \
> --vpc-public-subnets subnet-0b10715b2edf27dde,subnet-023105dfe3f0a2bdb  \
> --nodegroup-name test123-nodes \
> --node-type t3.small \
> --nodes 2 \
> --nodes-min 1 \
> --nodes-max 3 \
> --managed \
> --version 1.23 \
> --region ap-northeast-1
2022-08-26 13:28:34 []  eksctl version 0.108.0
2022-08-26 13:28:34 []  using region ap-northeast-1
Error: invalid version, supported values: 1.19, 1.20, 1.21, 1.22

EKS で サポートされる Kubernetes のバージョンが追加されたからといって、同時に そのバージョンに対応した eksctl がリリースされているわけではないんですね。

で、約 2週間ほど経って、 eksctl のリリース情報を確認すると、どうやら バージョン 1.109.0 で Kubernetes のバージョン 1.23 に対応したことがわかりました。

newreleases.io

この eksctl のリリース情報をみると、EKS で 1.23 のサポートがアナウンスされてから、約 1週間後 くらいにリリースされたようです。

AWSAmazon EKS のドキュメントで eksctl のインストールの説明部分をみると、英語版の方では、バージョンの表示例が 1.0.9 になっていました。(2022年8月27日現在)

Installing or updating eksctl - Amazon EKS

If you have eksctl installed in the path of your device, the example output is as follows. If you want to update the version that you currently have installed with a later version, complete the next step, making sure to install the new version in the same location that your current version is in. 0.109.0

ただし、日本語の方では、バージョンの表示例は まだ 1.0.5 になっていました。(2022年8月27日現在)いずれ更新されると思います。

eksctl のインストールまたは更新 - Amazon EKS

eksctl がデバイスのパスにインストールされている場合、出力例は次のようになります。現在インストールされているバージョンを新しいバージョンで更新する場合は、次の手順を完了し、新しいバージョンを現在のバージョンと同じ場所にインストールするようにします。 0.105.0

ともあれ、eksctl で バージョン 1.23 の EKS クラスターを作成できるようになったのは、嬉しい事です。

早速、eksctl のバージョンを 1.109.0 にアップグレードして、EKSクラスター 1.23 の作成を試してみました。

$ eksctl version
0.109.0
$ eksctl create cluster \
> --name test123-cluster \
> --vpc-public-subnets subnet-0b10715b2edf27dde,subnet-023105dfe3f0a2bdb  \
> --nodegroup-name test123-nodes \
> --node-type t3.small \
> --nodes 2 \
> --nodes-min 1 \
> --nodes-max 3 \
> --managed \
> --version 1.23 \
> --region ap-northeast-1
2022-08-26 13:15:16 []  eksctl version 0.109.0
2022-08-26 13:15:16 []  using region ap-northeast-1
2022-08-26 13:15:16 []  using existing VPC (vpc-0260526e8e00b9bb6) and subnets (private:map[] public:map[ap-northeast-1a:{subnet-0b10715b2edf27dde ap-northeast-1a 10.0.0.0/24 0} ap-northeast-1c:{subnet-023105dfe3f0a2bdb ap-northeast-1c 10.0.10.0/24 0}])
2022-08-26 13:15:16 [!]  custom VPC/subnets will be used; if resulting cluster doesn't function as expected,make sure to review the configuration of VPC/subnets
2022-08-26 13:15:16 [ℹ]  nodegroup "test123-nodes" will use "" [AmazonLinux2/1.23]
2022-08-26 13:15:16 [ℹ]  using Kubernetes version 1.23
2022-08-26 13:15:16 [ℹ]  creating EKS cluster "test123-cluster" in "ap-northeast-1" region with managed nodes
2022-08-26 13:15:16 [ℹ]  will create 2 separate CloudFormation stacks for cluster itself and the initial managed nodegroup
2022-08-26 13:15:16 [ℹ]  if you encounter any issues, check CloudFormation console or try 'eksctl utils describe-stacks --region=ap-northeast-1 --cluster=test123-cluster'
2022-08-26 13:15:16 [ℹ]  Kubernetes API endpoint access will use default of {publicAccess=true, privateAccess=false} for cluster "test123-cluster" in "ap-northeast-1"
2022-08-26 13:15:16 [ℹ]  CloudWatch logging will not be enabled for cluster "test123-cluster" in "ap-northeast-1"
2022-08-26 13:15:16 [ℹ]  you can enable it with 'eksctl utils update-cluster-logging --enable-types={SPECIFY-YOUR-LOG-TYPES-HERE (e.g. all)} --region=ap-northeast-1 --cluster=test123-cluster'
2022-08-26 13:15:16 [ℹ]
2 sequential tasks: { create cluster control plane "test123-cluster",
    2 sequential sub-tasks: {
        wait for control plane to become ready,
        create managed nodegroup "test123-nodes",
    }
}
2022-08-26 13:15:16 [ℹ]  building cluster stack "eksctl-test123-cluster-cluster"
2022-08-26 13:15:16 [ℹ]  deploying stack "eksctl-test123-cluster-cluster"
2022-08-26 13:15:46 [ℹ]  waiting for CloudFormation stack "eksctl-test123-cluster-cluster"
(中略)
2022-08-26 13:29:18 [ℹ]  building managed nodegroup stack "eksctl-test123-cluster-nodegroup-test123-nodes"
2022-08-26 13:29:18 [ℹ]  deploying stack "eksctl-test123-cluster-nodegroup-test123-nodes"
2022-08-26 13:29:18 [ℹ]  waiting for CloudFormation stack "eksctl-test123-cluster-nodegroup-test123-nodes"
(中略)
2022-08-26 13:33:01 [ℹ]  waiting for the control plane availability...
2022-08-26 13:33:03 [ℹ]  saved kubeconfig as "/home/ssm-user/.kube/config"
2022-08-26 13:33:03 [ℹ]  no tasks
2022-08-26 13:33:03 [ℹ]  all EKS cluster resources for "test123-cluster" have been created
2022-08-26 13:33:03 [ℹ]  nodegroup "test123-nodes" has 2 node(s)
2022-08-26 13:33:03 [ℹ]  node "ip-10-0-0-138.ap-northeast-1.compute.internal" is ready
2022-08-26 13:33:03 [ℹ]  node "ip-10-0-10-72.ap-northeast-1.compute.internal" is ready
2022-08-26 13:33:03 [ℹ]  waiting for at least 1 node(s) to become ready in "test123-nodes"
2022-08-26 13:33:03 [ℹ]  nodegroup "test123-nodes" has 2 node(s)
2022-08-26 13:33:03 [ℹ]  node "ip-10-0-0-138.ap-northeast-1.compute.internal" is ready
2022-08-26 13:33:03 [ℹ]  node "ip-10-0-10-72.ap-northeast-1.compute.internal" is ready
2022-08-26 13:33:05 [ℹ]  kubectl command should work with "/home/ssm-user/.kube/config", try 'kubectl get nodes'
2022-08-26 13:33:05 [ℹ]  EKS cluster "test123-cluster" in "ap-northeast-1" region is ready
$

期待通り、問題なく作成できました!

EKS クラスターは、eksctl 以外でも、AWS マネジメントコンソール や AWS CLI でも作成できますが、私は、EKS クラスターを作成する場合は、eksctl を使う派ですので、ようやく バージョン1.23 を eksctl で作成することができた、と感じています。

Amazon EKS でサポートされる バージョンが追加されたとき、どれくらいのタイムラグで、そのバージョンに対応した eksctl がリリースされるのかは、今後も注目していきたいと思います。

/* -----codeの行番号----- */