Labsco
openshift logo

Create HC AWS

โ˜… 527

by openshift ยท part of openshift/hypershift

Create a HyperShift HostedCluster on AWS for development and testing, with optional custom CPO/HO images.

๐Ÿ”Œ 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.

Create HostedCluster

This skill creates a HyperShift HostedCluster on AWS for development and testing purposes. The clusters created are intended for local development workflows, not for production use.

When to Use This Skill

Use this skill when:

  • You need to create a dev/test HostedCluster for manual verification
  • You want to test HyperShift features against a live cluster
  • You need a HostedCluster with custom CPO or HO images
  • You are iterating on code changes and need a cluster to validate them

Basic Command

source $AWS_CREDS_SOURCE && \
KUBECONFIG=$MGMT_KUBECONFIG \
./bin/hypershift create cluster aws \
  --name <CLUSTER_NAME> \
  --namespace clusters \
  --base-domain $BASE_DOMAIN \
  --aws-creds $AWS_CREDENTIALS \
  --pull-secret $PULL_SECRET \
  --region $AWS_REGION \
  --release-image quay.io/openshift-release-dev/ocp-release:4.21.0-multi \
  --node-pool-replicas 2

Common Parameters

ParameterDescriptionDefault
--nameName of the HostedClusterRequired
--namespaceNamespace for the HostedClusterclusters
--base-domainBase DNS domain$BASE_DOMAIN
--aws-credsPath to AWS credentials file$AWS_CREDENTIALS
--pull-secretPath to pull secret file$PULL_SECRET
--regionAWS region$AWS_REGION
--release-imageOCP release imageLatest 4.21.0 multi-arch
--node-pool-replicasInitial node count0 (add nodes later)
--control-plane-operator-imageCustom CPO imageOptional

With Custom CPO Image

When testing CPO changes, add the custom image:

source $AWS_CREDS_SOURCE && \
KUBECONFIG=$MGMT_KUBECONFIG \
./bin/hypershift create cluster aws \
  --name my-test-cluster \
  --namespace clusters \
  --base-domain $BASE_DOMAIN \
  --aws-creds $AWS_CREDENTIALS \
  --pull-secret $PULL_SECRET \
  --region $AWS_REGION \
  --release-image quay.io/openshift-release-dev/ocp-release:4.21.0-multi \
  --node-pool-replicas 2 \
  --control-plane-operator-image $CPO_IMAGE_REPO:YOUR_TAG

What Gets Created

The command creates:

  • AWS VPC with public and private subnets
  • NAT gateway and internet gateway
  • Route tables
  • Private hosted zones (Route53)
  • OIDC provider for STS
  • IAM roles for control plane components
  • Worker instance profile
  • HostedCluster and NodePool resources

Post-Creation Steps

  1. Check HostedCluster status:

    KUBECONFIG=$MGMT_KUBECONFIG kubectl get hostedcluster -n clusters
  2. Wait for control plane to be available:

    KUBECONFIG=$MGMT_KUBECONFIG kubectl wait --for=condition=Available \
      hostedcluster/<CLUSTER_NAME> -n clusters --timeout=10m
  3. Scale NodePool to add nodes:

    KUBECONFIG=$MGMT_KUBECONFIG kubectl scale nodepool <NODEPOOL_NAME> \
      -n clusters --replicas=1
  4. Get guest cluster kubeconfig:

    KUBECONFIG=$MGMT_KUBECONFIG kubectl get secret <CLUSTER_NAME>-admin-kubeconfig \
      -n clusters -o jsonpath='{.data.kubeconfig}' | base64 -d > /tmp/guest-kubeconfig.yaml

Cleanup

Use the dev:destroy-hc-aws skill or run:

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