本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
子網路設定
將私有子網路用於初始節點群組
如果您想要隔離初始節點群組與公有網際網路,您可以使用 --node-private-networking旗標。搭配 --ssh-access旗標使用時,SSH 連接埠只能從 VPC 內部存取。
注意
使用 --node-private-networking旗標將導致傳出流量使用其彈性 IP 通過 NAT 閘道。另一方面,如果節點位於公有子網路中,傳出流量將不會通過 NAT 閘道,因此傳出流量具有每個個別節點的 IP。
自訂子網路拓撲
eksctl 版本0.32.0引進了進一步的子網路拓撲自訂,並能夠:
-
在 VPC 組態中列出每個 AZ 的多個子網路
-
在節點群組組態中指定子網路
在舊版中,自訂子網路必須由可用區域提供,這表示每個可用區域只能列出一個子網路。從識別金鑰可以是任意0.32.0的。
vpc: id: "vpc-11111" subnets: public: public-one: # arbitrary key id: "subnet-0153e560b3129a696" public-two: id: "subnet-0cc9c5aebe75083fd" us-west-2b: # or list by AZ id: "subnet-018fa0176ba320e45" private: private-one: id: "subnet-0153e560b3129a696" private-two: id: "subnet-0cc9c5aebe75083fd"
重要
如果使用 AZ 做為識別金鑰,則可以省略該az值。
如果使用任意字串做為識別金鑰,如上所示,則:
-
id必須設定 (az和cidr選用) -
az必須設定 或 (cidr選用)
如果使用者在未指定 CIDR 和 ID 的情況下依 AZ 指定子網路,則該 AZ 中的子網路將從 VPC 中任意選擇,如果存在多個此類子網路。
注意
必須提供完整的子網路規格,即 VPC 規格中宣告的 public和 private組態。
節點群組可以透過 組態限制為具名子網路。在節點群組組態上指定子網路時,請使用 VPC 規格中指定的識別金鑰,而不是子網路 ID。例如:
vpc: id: "vpc-11111" subnets: public: public-one: id: "subnet-0153e560b3129a696" ... # subnet spec continued nodeGroups: - name: ng-1 instanceType: m5.xlarge desiredCapacity: 2 subnets: - public-one
注意
節點群組組態中availabilityZones只能提供其中一個 subnets或 。
在私有子網路中放置節點群組時,privateNetworking必須在節點群組true上將 設定為 :
vpc: id: "vpc-11111" subnets: public: private-one: id: "subnet-0153e560b3129a696" ... # subnet spec continued nodeGroups: - name: ng-1 instanceType: m5.xlarge desiredCapacity: 2 privateNetworking: true subnets: - private-one
如需完整組態範例,請參閱 eksctl GitHub 儲存庫中的 24-nodegroup-subnets.yaml