本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
自訂子網路
您可以延伸具有新子網路的現有 VPC,並將 Nodegroup 新增至該子網路。
為什麼
如果叢集用完預先設定的 IPs,可以使用新的 CIDR 調整現有 VPC 的大小,以為其新增新的子網路。若要了解如何執行此操作,請參閱 AWS Extending VPCs上的本指南。
TL;DR
前往 VPC 的組態,並按一下 Actions->Edit CIDRs並新增範圍。例如:
192.168.0.0/19 -> existing CIDR + 192.169.0.0/19 -> new CIDR
現在您需要新增子網路。視新的私有或公有子網路而定,您必須分別從私有或公有子網路複製路由資訊。
子網路建立後,請新增路由,並從 VPC 中的另一個子網路複製 NAT 閘道 ID 或網際網路閘道。如果是公有子網路,請小心啟用自動 IP 指派。Actions->Modify auto-assign IP settings->Enable auto-assign public IPv4 address。
也別忘了根據公有或私有子網路組態複製現有子網路的 TAGS。這很重要,否則子網路不會成為叢集的一部分,子網路中的執行個體將無法加入。
完成後,複製新子網路的 ID。視需要重複此動作。
方法
若要在建立的子網路 (子網路) 中建立節點群組,請執行下列命令:
eksctl create nodegroup --cluster <cluster-name> --name my-new-subnet --subnet-ids subnet-0edeb3a04bec27141,subnet-0edeb3a04bec27142,subnet-0edeb3a04bec27143 # or for a single subnet id eksctl create nodegroup --cluster <cluster-name> --name my-new-subnet --subnet-ids subnet-0edeb3a04bec27141
或者,使用以下組態:
eksctl create nodegroup -f cluster-managed.yaml
使用如下的組態:
# A simple example of ClusterConfig object with two nodegroups: --- apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: cluster-3 region: eu-north-1 nodeGroups: - name: new-subnet-nodegroup instanceType: m5.large desiredCapacity: 1 subnets: - subnet-id1 - subnet-id2
等待節點群組建立,且新執行個體應具有子網路的新 IP 範圍 (子網路)。
刪除叢集
由於新的新增透過在 CloudFormation 堆疊之外新增相依性來修改現有的 VPC,因此 CloudFormation 無法再移除叢集。
刪除叢集之前,請手動移除所有建立的額外子網路,然後呼叫 以繼續eksctl
:
eksctl delete cluster -n <cluster-name> --wait