Labsco
openshift logo

Destroy HC AWS

โ˜… 527

by openshift ยท part of openshift/hypershift

Destroy a HyperShift HostedCluster and all associated AWS infrastructure (VPC, IAM, Route53, etc.).

๐Ÿ”Œ This skill ships inside the hypershift plugin โ€” install the plugin and you also get 7 slash commands, 5 sub-agents.

This is the playbook your agent receives when the skill activates โ€” you don't need to read it to use the skill, but it's here to audit before installing.

Destroy HostedCluster

This skill destroys a HyperShift HostedCluster and all associated AWS infrastructure.

When to Use This Skill

Use this skill when:

  • You need to clean up a test HostedCluster
  • You want to destroy a HostedCluster and its AWS resources (VPC, subnets, NAT gateways, IAM roles, etc.)
  • You need to remove orphaned HostedClusters from previous test runs

Command

source $AWS_CREDS_SOURCE && \
KUBECONFIG=$MGMT_KUBECONFIG \
./bin/hypershift destroy cluster aws \
  --name <CLUSTER_NAME> \
  --namespace <NAMESPACE> \
  --aws-creds $AWS_CREDENTIALS \
  --region $AWS_REGION

Parameters

ParameterDescriptionDefault
--nameName of the HostedCluster to destroyRequired
--namespaceNamespace where the HostedCluster existsclusters
--aws-credsPath to AWS credentials file$AWS_CREDENTIALS
--regionAWS region$AWS_REGION

What Gets Destroyed

The command destroys:

  • HostedCluster and NodePool resources
  • HostedControlPlane namespace and all resources
  • AWS VPC and subnets
  • NAT gateways and internet gateways
  • Route tables
  • Security groups
  • DHCP options
  • Private hosted zones (Route53)
  • OIDC provider
  • IAM roles and instance profiles
  • VPC endpoints
  • Elastic IPs

Quick Cleanup for Orphaned HCs

If a HostedCluster is stuck deleting, you can force remove it:

# Remove cleanup annotation to skip cloud resource cleanup
KUBECONFIG=$MGMT_KUBECONFIG kubectl annotate hostedcluster <NAME> -n <NAMESPACE> \
  hypershift.openshift.io/cleanup-cloud-resources-