Gunakan DeleteNodegroup dengan AWS SDK atau CLI - AWS Contoh Kode SDK

Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc. GitHub

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan DeleteNodegroup dengan AWS SDK atau CLI

Contoh kode berikut menunjukkan cara menggunakanDeleteNodegroup.

CLI
AWS CLI

Contoh 1: Menghapus grup node terkelola untuk klaster Amazon EKS

delete-nodegroupContoh berikut menghapus grup node terkelola untuk klaster Amazon EKS.

aws eks delete-nodegroup \ --cluster-name my-eks-cluster \ --nodegroup-name my-eks-nodegroup

Output:

{ "nodegroup": { "nodegroupName": "my-eks-nodegroup", "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/1ec75f5f-0e21-dcc0-b46e-f9c442685cd8", "clusterName": "my-eks-cluster", "version": "1.26", "releaseVersion": "1.26.12-20240329", "createdAt": "2024-04-08T13:25:15.033000-04:00", "modifiedAt": "2024-04-08T13:25:31.252000-04:00", "status": "DELETING", "capacityType": "SPOT", "scalingConfig": { "minSize": 1, "maxSize": 5, "desiredSize": 4 }, "instanceTypes": [ "t3.large" ], "subnets": [ "subnet-0e2907431c9988b72", "subnet-04ad87f71c6e5ab4d", "subnet-09d912bb63ef21b9a" ], "amiType": "AL2_x86_64", "nodeRole": "arn:aws:iam::111122223333:role/role-name", "labels": { "my-eks-nodegroup-label-2": "value-2", "my-eks-nodegroup-label-1": "value-1" }, "taints": [ { "key": "taint-key-1", "value": "taint-value-1", "effect": "NO_EXECUTE" } ], "diskSize": 50, "health": { "issues": [] }, "updateConfig": { "maxUnavailable": 2 }, "tags": { "my-eks-nodegroup-key-1": "value-1", "my-eks-nodegroup-key-2": "value-2" } } }
PowerShell
Alat untuk PowerShell

Contoh 1: Cmdlet ini menghapus grup node Amazon EKS untuk sebuah cluster.

Remove-EKSNodegroup -NodegroupName "ProdEKSNodeGroup" -ClusterName "PROD"

Output:

Confirm Are you sure you want to perform this action? Performing the operation "Remove-EKSNodegroup (DeleteNodegroup)" on target "ProdEKSNodeGroup". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y AmiType : AL2_x86_64 ClusterName : PROD CreatedAt : 12/25/2019 10:16:45 AM DiskSize : 40 Health : Amazon.EKS.Model.NodegroupHealth InstanceTypes : {t3.large} Labels : {} ModifiedAt : 12/25/2019 11:01:16 AM NodegroupArn : arn:aws:eks:us-west-2:012345678912:nodegroup/PROD/ProdEKSNodeGroup/7eb79e47-82b6-04d9-e984-95110db6fa85 NodegroupName : ProdEKSNodeGroup NodeRole : arn:aws:iam::012345678912:role/NodeInstanceRole ReleaseVersion : 1.14.7-20190927 RemoteAccess : Resources : Amazon.EKS.Model.NodegroupResources ScalingConfig : Amazon.EKS.Model.NodegroupScalingConfig Status : DELETING Subnets : {subnet-0d1a9fff35efa7691, subnet-0a3f4928edbc224d4} Tags : {} Version : 1.14
  • Untuk detail API, lihat DeleteNodegroupdi Referensi AWS Tools for PowerShell Cmdlet.