Total Pageviews

2024/06/10

[AWS Cloud Shell Error] eksctl: command not found

Problem

當我透過 CloudShell 執行 eksctl 指令出現以下錯誤訊息

[cloudshell-user@ip-10-138-162-6 ~]$ eksctl create cluster -f cluster.yaml 
-bash: eksctl: command not found


Root Cause

若在執行 eksctl 指令時出現 "command not found" 的錯誤,表示您還未安裝 eksctl

How-To

以下是安裝 eksctl 並解決這個問題的步驟:
以下是安裝 eksctl 並解決這個問題的步驟:
# 下載最新版本的 eksctl
[cloudshell-user@ip-10-138-162-6 ~]$ curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp

# 將可執行文件移動到 /usr/local/bin
[cloudshell-user@ip-10-138-162-6 ~]$ sudo mv /tmp/eksctl /usr/local/bin

# 驗證安裝
[cloudshell-user@ip-10-138-162-6 ~]$ eksctl version
0.182.0

# 執行結果
[cloudshell-user@ip-10-138-162-6 ~]$ eksctl create cluster -f cluster.yaml 
2024-06-10 06:15:21 []  eksctl version 0.182.0
2024-06-10 06:15:21 []  using region us-east-1
2024-06-10 06:15:21 []  skipping us-east-1e from selection because it doesn't support the following instance type(s): t3.micro
2024-06-10 06:15:21 [ℹ]  setting availability zones to [us-east-1c us-east-1b]
2024-06-10 06:15:21 [ℹ]  subnets for us-east-1c - public:10.0.0.0/19 private:10.0.64.0/19
2024-06-10 06:15:21 [ℹ]  subnets for us-east-1b - public:10.0.32.0/19 private:10.0.96.0/19
2024-06-10 06:15:21 [ℹ]  nodegroup "eks-node-group" will use "ami-0bcb49642ac49d5aa" [AmazonLinux2/1.24]
2024-06-10 06:15:21 [ℹ]  using Kubernetes version 1.24
2024-06-10 06:15:21 [ℹ]  creating EKS cluster "eks-acg" in "us-east-1" region with un-managed nodes
2024-06-10 06:15:21 [ℹ]  1 nodegroup (eks-node-group) was included (based on the include/exclude rules)
2024-06-10 06:15:21 [ℹ]  will create a CloudFormation stack for cluster itself and 1 nodegroup stack(s)
2024-06-10 06:15:21 [ℹ]  will create a CloudFormation stack for cluster itself and 0 managed nodegroup stack(s)
2024-06-10 06:15:21 [ℹ]  if you encounter any issues, check CloudFormation console or try 'eksctl utils describe-stacks --region=us-east-1 --cluster=eks-acg'