本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
自訂 AMI 支援
設定節點 AMI ID
--node-ami
旗標會啟用多種進階使用案例,例如使用自訂 AMI 或即時查詢 AWS,以判斷要使用的 AMI。旗標可用於非 GPU 和 GPU 映像。
旗標可以取得影像的 AMI 影像 ID 以明確使用。它也可以使用下列「特殊」關鍵字:
關鍵字 | 描述 |
---|---|
auto |
指出應該透過查詢 AWS EC2 找到用於節點的 AMI。這與自動解析程式有關。 |
自動ssm |
指出應該透過查詢 AWS SSM 參數存放區找到用於節點的 AMI。 |
注意
--node-ami
將 設定為 ID 字串時, eksctl
會假設已請求自訂 AMI。對於 AmazonLinux2 和 Ubuntu 節點,EKS 受管和自我管理,這表示overrideBootstrapCommand
這是必要的。對於 AmazonLinux2023,由於overrideBootstrapCommand
其停止將/etc/eks/bootstrap.sh
指令碼用於節點引導,因此不支援節點廣告初始化程序 (如需詳細資訊,請參閱節點引導文件
CLI 旗標範例:
eksctl create cluster --node-ami=auto # with a custom ami id eksctl create cluster --node-ami=ami-custom1234
Config 檔案範例:
nodeGroups: - name: ng1 instanceType: p2.xlarge amiFamily: AmazonLinux2 ami: auto - name: ng2 instanceType: m5.large amiFamily: AmazonLinux2 ami: ami-custom1234 managedNodeGroups: - name: m-ng-2 amiFamily: AmazonLinux2 ami: ami-custom1234 instanceType: m5.large overrideBootstrapCommand: | #!/bin/bash /etc/eks/bootstrap.sh <cluster-name>
--node-ami
旗標也可以與 搭配使用eksctl create nodegroup
。
設定節點 AMI 系列
--node-ami-family
可以採用下列關鍵字:
關鍵字 | 描述 |
---|---|
AmazonLinux2 |
指出應使用以 Amazon Linux 2 為基礎的 EKS AMI 映像 (預設)。 |
AmazonLinux2023 |
表示應使用以 Amazon Linux 2023 為基礎的 EKS AMI 映像。 |
Ubuntu2004 |
表示應使用以 Ubuntu 20.04 LTS (Focal) 為基礎的 EKS AMI 映像 (支援 EKS ⇐ 1.29)。 |
UbuntuPro2004 |
指出應使用以 Ubuntu Pro 20.04 LTS (Focal) 為基礎的 EKS AMI 映像 (適用於 EKS >= 1.27、⇐ 1.29)。 |
Ubuntu2204 |
表示應使用以 Ubuntu 22.04 LTS (Jammy) 為基礎的 EKS AMI 映像 (適用於 EKS >= 1.29)。 |
UbuntuPro2204 |
表示應使用以 Ubuntu Pro 22.04 LTS (Jammy) 為基礎的 EKS AMI 映像 (適用於 EKS >= 1.29)。 |
Ubuntu2404 |
表示應使用以 Ubuntu 24.04 LTS (Noble) 為基礎的 EKS AMI 映像 (適用於 EKS >= 1.31)。 |
UbuntuPro2404 |
表示應使用以 Ubuntu Pro 24.04 LTS (Noble) 為基礎的 EKS AMI 映像 (適用於 EKS >= 1.31)。 |
Bottlerocket |
指出應使用以 Bottlerocket 為基礎的 EKS AMI 映像。 |
WindowsServer2019FullContainer |
表示應使用以 Windows Server 2019 完整容器為基礎的 EKS AMI 映像。 |
WindowsServer2019CoreContainer |
指出應使用以 Windows Server 2019 Core Container 為基礎的 EKS AMI 映像。 |
WindowsServer2022FullContainer |
表示應使用以 Windows Server 2022 完整容器為基礎的 EKS AMI 映像。 |
WindowsServer2022CoreContainer |
指出應使用以 Windows Server 2022 Core Container 為基礎的 EKS AMI 映像。 |
CLI 標記範例:
eksctl create cluster --node-ami-family=AmazonLinux2
Config 檔案範例:
nodeGroups: - name: ng1 instanceType: m5.large amiFamily: AmazonLinux2 managedNodeGroups: - name: m-ng-2 instanceType: m5.large amiFamily: Ubuntu2204
--node-ami-family
旗標也可以與 搭配使用eksctl create nodegroup
。每當使用自訂 AMI 時, eksctl
需要透過組態檔案或透過 --node-ami-family
CLI 旗標明確設定 AMI 系列。
注意
目前,EKS 受管節點群組在使用自訂 AMI 時僅支援下列 AMIs 系列:AmazonLinux2023
、Ubuntu1804
、 AmazonLinux2
Ubuntu2004
和 Ubuntu2204
Windows 自訂 AMI 支援
只有自我管理的 Windows 節點群組可以指定自訂 AMI。 amiFamily
應該設定為有效的 Windows AMI 系列。
引導指令碼將可使用下列 PowerShell 變數:
$EKSBootstrapScriptFile
$EKSClusterName
$APIServerEndpoint
$Base64ClusterCA
$ServiceCIDR
$KubeletExtraArgs
$KubeletExtraArgsMap: A hashtable containing arguments for the kubelet, e.g., @{ 'node-labels' = ''; 'register-with-taints' = ''; 'max-pods' = '10'}
$DNSClusterIP
$ContainerRuntime
Config 檔案範例:
nodeGroups: - name: custom-windows amiFamily: WindowsServer2022FullContainer ami: ami-01579b74557facaf7 overrideBootstrapCommand: | & $EKSBootstrapScriptFile -EKSClusterName "$EKSClusterName" -APIServerEndpoint "$APIServerEndpoint" -Base64ClusterCA "$Base64ClusterCA" -ContainerRuntime "containerd" -KubeletExtraArgs "$KubeletExtraArgs" 3>&1 4>&1 5>&1 6>&1
Bottlerocket 自訂 AMI 支援
對於 Bottlerocket 節點,overrideBootstrapCommand
不支援 。相反地,若要指定自己的引導容器,應該使用 bottlerocket
欄位做為組態檔案的一部分。例如
nodeGroups: - name: bottlerocket-ng ami: ami-custom1234 amiFamily: Bottlerocket bottlerocket: enableAdminContainer: true settings: bootstrap-containers: bootstrap: source: <MY-CONTAINER-URI>