hypershift-debug
Skill1 starsChanged 20 days agoApache-2.0View on GitHub
Debug AWS resources for HyperShift clusters: identify stuck resources, orphaned infrastructure, and deletion blockers. Use when a cluster deletion is stuck, you need to find orphaned AWS resources, or you are diagnosing IAM permission errors during cluster operations.
- Reads credentials
In this repository9 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- byo-rossoctl-cortexSkill
- github-pr-reviewSkill
- hypershift-cleanupSkill
- hypershift-clusterSkill
- hypershift-preflightSkill
- hypershift-quotasSkill
- hypershift-setupSkill
- hypershiftSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 19 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈19
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
Ensure credentials are loaded:
- Distinctive: line 207
If you need to manually delete AWS resources, delete in this order:
- Distinctive: line 210
NAT Gateways: - Delete and wait for deletion
- Very specific: line 212
Load Balancers: - Delete ELBs/ALBs/NLBs
- Distinctive: line 213
Security Groups: - Delete (may need multiple passes for dependencies)
- Distinctive: line 214
Subnets: - Delete all subnets
- Distinctive: line 217
Route53: - Delete private hosted zone
- Distinctive: line 219
IAM Roles: - Delete roles and instance profiles
- Distinctive: line 220
OIDC Provider: - Delete OIDC provider
- Distinctive: line 245
Check HyperShift operator logs for errors
- Distinctive: line 246
Check AWS resources still exist (VPCs, subnets, etc.)
- Distinctive: line 247
Verify IAM permissions for resource deletion
- Distinctive: line 248
Check if resources have dependencies blocking deletion
- Distinctive: line 261
Check which resource deletion is failing
- Distinctive: line 262
Verify IAM policy has permission for that resource type
- Very specific: line 263
Check if tag conditions match (kubernetes.io/cluster/<cluster-name>)
- Distinctive: line 265
Fix: Update IAM policies and re-run setup script:
- Distinctive: line 275
Run this debug skill to find remaining resources
- Distinctive: line 277
Follow manual cleanup order above
- Distinctive: line 281
hypershift-cluster: Create and destroy clusters
- Distinctive: line 282
hypershift-quotas: Check AWS quotas before debugging
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AWS HyperShift Debug Skill
This skill helps debug AWS resources related to HyperShift clusters, identifying resources that may be blocking cluster deletion or orphaned infrastructure.
Scripts referenced here live in ../hypershift-cluster/scripts/.
Context-Safe Execution (MANDATORY)
AWS CLI and kubectl output MUST go to files.
export LOG_DIR=/tmp/rossoctl/hypershift/${CLUSTER:-debug}
mkdir -p $LOG_DIR
# Pattern: redirect AWS/kubectl output
aws ec2 describe-vpcs ... > $LOG_DIR/vpcs.log 2>&1 && echo "OK" || echo "FAIL"
kubectl get hostedclusters -A > $LOG_DIR/clusters.log 2>&1 && echo "OK" || echo "FAIL"
# Analyze in subagent: Task(subagent_type='Explore') with GrepWhen to Use
- Cluster deletion is stuck (finalizer not removed)
- Need to identify orphaned AWS resources
- Debugging IAM permission issues during cluster operations
- Verifying cleanup after cluster destruction
- User asks "debug hypershift" or "why is cluster stuck"
Arguments
cluster-name: The HyperShift cluster name or suffix to debug (optional, defaults to local)--check: Quiet mode - returns exit code only (0=no resources, 1=resources exist)
Quick Debug Commands
Prerequisites
Ensure credentials are loaded:
# Load HyperShift credentials (from your working directory)
source .env.rossoctl-hypershift-custom # or .env.hypershift-ciRun Full Debug Script
# Run comprehensive AWS debug
../hypershift-cluster/scripts/debug-aws-hypershift.sh [cluster-name]
# Examples:
../hypershift-cluster/scripts/debug-aws-hypershift.sh # defaults to username
../hypershift-cluster/scripts/debug-aws-hypershift.sh ladas # suffix only
../hypershift-cluster/scripts/debug-aws-hypershift.sh rossoctl-hypershift-custom-ladas # full name
../hypershift-cluster/scripts/debug-aws-hypershift.sh pr529
# Check mode (quiet, returns exit code only)
../hypershift-cluster/scripts/debug-aws-hypershift.sh --check ladas
echo $? # 0 = no resources, 1 = resources existManual Debug Commands
Check HostedCluster Status
# Set management cluster kubeconfig
source .env.rossoctl-hypershift-custom # loads KUBECONFIG
# Get HostedCluster status
oc get hostedcluster -n clusters <cluster-name> -o yaml
# Check deletion timestamp and finalizers
oc get hostedcluster -n clusters <cluster-name> -o jsonpath='{.metadata.deletionTimestamp}{"\n"}{.metadata.finalizers}'
# Check conditions
oc get hostedcluster -n clusters <cluster-name> -o jsonpath='{range .status.conditions[*]}{.type}{": "}{.status}{" - "}{.message}{"\n"}{end}'Check HyperShift Operator Logs
# Operator logs (filtered for cluster)
oc logs -n hypershift -l app=operator --tail=200 | grep -i "<cluster-name>\|error\|failed\|denied"
# All operator logs
oc logs -n hypershift -l app=operator --tail=500EC2 Resources
# EC2 Instances
aws ec2 describe-instances \
--filters "Name=tag-key,Values=kubernetes.io/cluster/<cluster-name>" \
--query 'Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType,Tags[?Key==`Name`].Value|[0]]' \
--output table
# VPCs
aws ec2 describe-vpcs \
--filters "Name=tag-key,Values=kubernetes.io/cluster/<cluster-name>" \
--query 'Vpcs[*].[VpcId,State,CidrBlock]' \
--output table
# Subnets
aws ec2 describe-subnets \
--filters "Name=tag-key,Values=kubernetes.io/cluster/<cluster-name>" \
--query 'Subnets[*].[SubnetId,State,CidrBlock,AvailabilityZone]' \
--output table
# Security Groups
aws ec2 describe-security-groups \
--filters "Name=tag-key,Values=kubernetes.io/cluster/<cluster-name>" \
--query 'SecurityGroups[*].[GroupId,GroupName,VpcId]' \
--output table
# NAT Gateways
aws ec2 describe-nat-gateways \
--filter "Name=tag-key,Values=kubernetes.io/cluster/<cluster-name>" \
--query 'NatGateways[*].[NatGatewayId,State,VpcId]' \
--output table
# Internet Gateways
aws ec2 describe-internet-gateways \
--filters "Name=tag-key,Values=kubernetes.io/cluster/<cluster-name>" \
--query 'InternetGateways[*].[InternetGatewayId,Attachments[0].VpcId]' \
--output table
# Elastic IPs
aws ec2 describe-addresses \
--filters "Name=tag-key,Values=kubernetes.io/cluster/<cluster-name>" \
--query 'Addresses[*].[AllocationId,PublicIp]' \
--output tableLoad Balancers
# Classic ELBs
aws elb describe-load-balancers \
--query "LoadBalancerDescriptions[?contains(LoadBalancerName, '<cluster-name>')].[LoadBalancerName,Scheme]" \
--output table
# ALB/NLBs
aws elbv2 describe-load-balancers \
--query "LoadBalancers[?contains(LoadBalancerName, '<cluster-name>')].[LoadBalancerName,Type,State.Code]" \
--output tableS3 Buckets
# List S3 buckets for cluster
aws s3api list-buckets --query "Buckets[?contains(Name, '<cluster-name>')].Name" --output text
# Check bucket contents (if exists)
aws s3 ls s3://<bucket-name>/ --recursiveIAM Resources
# IAM Roles
aws iam list-roles --query "Roles[?contains(RoleName, '<cluster-name>')].RoleName" --output text
# Instance Profiles
aws iam list-instance-profiles --query "InstanceProfiles[?contains(InstanceProfileName, '<cluster-name>')].InstanceProfileName" --output text
# OIDC Providers
aws iam list-open-id-connect-providers --query 'OpenIDConnectProviderList[*].Arn' --output text | tr '\t' '\n' | grep "<cluster-name>"Route53
# Hosted zones
aws route53 list-hosted-zones --query "HostedZones[?contains(Name, '<cluster-name>')].[Name,Id,Config.PrivateZone]" --output table
# All zones (for reference)
aws route53 list-hosted-zones --query 'HostedZones[*].[Name,Id,Config.PrivateZone]' --output tableCleanup Commands (Use with Caution)
Force Remove HostedCluster Finalizer
Warning: This orphans AWS resources. Only use if resources are already deleted or you will clean them manually.
oc patch hostedcluster -n clusters <cluster-name> \
-p '{"metadata":{"finalizers":null}}' --type=mergeManual Resource Cleanup Order
If you need to manually delete AWS resources, delete in this order:
- EC2 Instances - Terminate worker nodes
- NAT Gateways - Delete and wait for deletion
- Elastic IPs - Release after NAT gateways deleted
- Load Balancers - Delete ELBs/ALBs/NLBs
- Security Groups - Delete (may need multiple passes for dependencies)
- Subnets - Delete all subnets
- Internet Gateways - Detach and delete
- VPCs - Delete VPC
- Route53 - Delete private hosted zone
- S3 Buckets - Empty and delete OIDC bucket
- IAM Roles - Delete roles and instance profiles
- OIDC Provider - Delete OIDC provider
# Example: Delete all EC2 instances for a cluster
INSTANCE_IDS=$(aws ec2 describe-instances \
--filters "Name=tag-key,Values=kubernetes.io/cluster/<cluster-name>" \
--query 'Reservations[*].Instances[*].InstanceId' \
--output text)
aws ec2 terminate-instances --instance-ids $INSTANCE_IDSFind Orphaned Resources
# Find orphaned resources across all clusters
../hypershift-cluster/scripts/find-orphaned-resources.shCommon Issues
Issue: Cluster stuck in deletion
Symptoms: HostedCluster has deletionTimestamp but finalizer remains
Debug Steps:
- Check HyperShift operator logs for errors
- Check AWS resources still exist (VPCs, subnets, etc.)
- Verify IAM permissions for resource deletion
- Check if resources have dependencies blocking deletion
Common Causes:
- Security group has dependencies
- ENIs attached to resources
- Load balancer still has targets
- IAM policy doesn't allow deletion
Issue: Permission denied during deletion
Symptoms: Operator logs show "Access Denied" or "UnauthorizedOperation"
Debug Steps:
- Check which resource deletion is failing
- Verify IAM policy has permission for that resource type
- Check if tag conditions match (kubernetes.io/cluster/
<cluster-name>)
Fix: Update IAM policies and re-run setup script:
../hypershift-cluster/scripts/setup-hypershift-ci-credentials.shIssue: AWS resources orphaned
Symptoms: HostedCluster deleted but AWS resources remain
Debug Steps:
- Run this debug skill to find remaining resources
- Note all resource IDs
- Follow manual cleanup order above
Related Skills
- hypershift-cluster: Create and destroy clusters
- hypershift-quotas: Check AWS quotas before debugging
- hypershift-cleanup: TTL/label-based auto-cleanup of stale clusters
For management-cluster health, operator logs, and control-plane pod debugging,
see the general Kubernetes skills (k8s:health, k8s:logs, k8s:pods) in the
rossoctl repo.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

