AWS-DeleteEKSCluster - AWS Systems Manager
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

AWS-DeleteEKSCluster

描述

This document deletes the resources associated with an Amazon EKS cluster, including node groups and Fargate profiles. Optionally, you can choose to delete all self-managed nodes, the AWS CloudFormation stacks used to create the nodes, and the VPC CloudFormation stack for your cluster. For more information about deleting a cluster, see Deleting a cluster in the Amazon EKS 用户指南.

注意

If you have active services in your cluster that are associated with a load balancer, you must delete those services before deleting the cluster. If you don't, the system can't delete the load balancers. Use the following procedure to find and delete services before you run the AWS-DeleteEKSCluster document.

To locate and delete services in your cluster

  1. Install the Kubernetes command line utility, kubectl. For more information, see Installing kubectl in the Amazon EKS 用户指南.

  2. Run the following command to list all services running in your cluster.

    kubectl get svc --all-namespaces
  3. Run the following command to delete any services that have an associated EXTERNAL-IP value. These services are fronted by a load balancer, and you must delete them in Kubernetes to allow the load balancer and associated resources to be properly released.

    kubectl delete svc service-name

You can now run the AWS-DeleteEKSCluster document.

运行此 Automation(控制台)

文档类型

Automation

所有者

Amazon

平台

Linux、macOS、Windows

参数

  • AutomationAssumeRole

    类型:字符串

    说明:(可选)允许 Systems Manager Automation 代表您执行操作的 AWS Identity and Access Management (IAM) 角色的 Amazon 资源名称 (ARN)。如果未指定任何角色,则 Systems Manager Automation 使用运行此文档的用户的权限。

  • EKSClusterName

    类型: 字符串

    描述:(Required) The name of the Amazon EKS Cluster to be deleted.

  • VPCCloudFormationStack

    类型: 字符串

    描述:(Optional) AWS Cloudformation stack name for VPC for the EKS cluster being deleted. This deletes the AWS Cloudformation stack for VPC and any resources created by the stack.

  • VPCCloudFormationStackRole

    类型: 字符串

    描述:(Optional) The ARN of an IAM role that AWS CloudFormation assumes to delete the VPC CloudFormation stack. AWS CloudFormation uses the role's credentials to make calls on your behalf.

  • SelfManagedNodeStacks

    类型: 字符串

    描述:(Optional) Comma-separated list of AWS Cloudformation stack names for self-managed nodes, This will delete the AWS Cloudformation stacks for self-managed nodes.

  • SelfManagedNodeStacksRole

    类型: 字符串

    描述:(Optional) The ARN of an IAM role that AWS CloudFormation assumes to delete the Self-managed Node Stacks. AWS CloudFormation uses the role's credentials to make calls on your behalf.

所需的 IAM 权限

AutomationAssumeRole 需要执行以下操作才能成功运行 Automation 文档。

  • sts:AssumeRole

  • eks:ListNodegroups

  • eks:DeleteNodegroup

  • eks:ListFargateProfiles

  • eks:DeleteFargateProfile

  • eks:DeleteCluster

  • cfn:DescribeStacks

  • cfn:DeleteStack

文档步骤

  • aws:executeScript - DeleteNodeGroups: Find and delete all node groups in the EKS cluster.

  • aws:executeScript - DeleteFargateProfiles: Find and delete all Fargate profiles in the EKS cluster.

  • aws:executeScript - DeleteSelfManagedNodes: Delete all self-managed nodes and the CloudFormation stacks used to create the nodes.

  • aws:executeScript - DeleteEKSCluster: Delete EKS cluster.

  • aws:executeScript - DeleteVPCCloudFormationStack: Delete the VPC CloudFormation stack.