HyperShift Documentation

repository·main·Indexed 19 days ago

https://github.com/openshift/hypershift

Middleware for hosting OpenShift control planes at scale, focusing on cost efficiency, rapid provisioning, and cross-cloud portability. Includes guides for provisioning Azure infrastructure via `hypershift create infra azure`, managing Azure workload identities and RBAC, and using the `cleanleaked` tool to detect and remove leaked AWS resources from CI test runs.

Tokens
419.1K
Snippets
847
Records
1.4K
Agent score
68%

What's inside HyperShift

  1. What is HyperShift?

    main

    HyperShift is a middleware designed for hosting OpenShift control planes at scale. It addresses challenges related to cost, provisioning time, and cross-cloud portability by providing a strong separation of concerns between the management layer and the workload layer.

    Hosted clusters are fully compliant OpenShift Container Platform (OCP) clusters and maintain compatibility with standard OCP and Kubernetes toolchains.

  2. Overview of Self-Managed Azure HyperShift

    main

    Self-managed Azure HyperShift allows you to deploy and manage OpenShift hosted control planes on an existing OpenShift management cluster running in Azure.

    Architecture Layers

    1. Management Cluster: An existing Azure OpenShift cluster hosting the HyperShift operator and hosted cluster control planes.
    2. Control Plane: Kubernetes control plane components running as pods on the management cluster.
    3. Data Plane: Worker nodes running as Azure Virtual Machines in your Azure subscription.

    Key Differences from Managed Azure

    • Management Platform: Uses an OpenShift cluster instead of Azure Kubernetes Service (AKS).
    • Lifecycle: You are responsible for provisioning and managing the lifecycle of the management cluster.

    DNS Management Options

    You can choose between two DNS approaches depending on your use case:

    AspectWith External DNSWithout External DNS
    Best ForProduction, multi-clusterDevelopment, testing
    API Server DNSCustom (e.g., api-cluster.example.com)Azure LoadBalancer (e.g., abc123.region.cloudapp.azure.com)
    Setup ComplexityHigher (requires DNS zones, service principal)Lower (minimal configuration)
    ManagementFully automaticManual or Azure-provided

    Note: Self-managed Azure HostedClusters are available as a Developer Preview feature in OpenShift Container Platform 4.21.

  3. Identify the roles of HyperShift core components

    main

    HyperShift is composed of several specialized operators and services that manage the lifecycle of hosted clusters:

    ComponentRole
    HyperShift OperatorA singleton on the management cluster. It reconciles HostedCluster and NodePool resources, creates control plane namespaces, and deploys the CPO and CAPI controllers.
    Control Plane Operator (CPO)One instance per hosted cluster. It reconciles the HostedControlPlane and manages approximately 40 control plane components (like etcd and kube-apiserver) using the CPOv2 declarative framework.
    Control Plane PKI OperatorManages certificate rotation, CSR signing, and break-glass credential access for each hosted cluster.
    Karpenter OperatorManages Karpenter resources to handle node auto-scaling.
    Ignition ServerAn HTTPS server that generates and serves ignition configurations to worker nodes during the bootstrap process.
  4. Disaster Recovery methods for HostedControlPlanes

    main

    Hypershift provides several methods for performing disaster recovery (DR) on HostedControlPlanes. Depending on your requirements, you can use:

    • DR CLI: Use platform-aware backup creation and OADP integration via the HyperShift CLI.
    • OADP (OpenShift API for Data Protection): Manual backup and restore procedures using OADP with Velero. There are specific guides for standard OADP and updated procedures for OADP 1.5.
    • ETCD Recovery: Direct procedures for control plane data backup and restoration using ETCD.
    • Etcd Snapshot Backup (Tech Preview): An alternative method using native etcd snapshots instead of volume snapshots. This requires the HCPEtcdBackup feature gate.
  5. Supported Cloud Platforms in HyperShift

    main

    HyperShift supports multiple infrastructure platforms, including managed services and self-managed environments. Each platform implements a common Platform interface but uses different Cluster API (CAPI) providers, credential models, and networking primitives.

    Supported Platforms:

    • AWS: Self-Managed and Managed (ROSA HCP)
    • Azure: Self-Managed and Managed (ARO HCP)
    • GCP: Self-Managed (feature-gated) and Managed (GCP HCP)
    • Virtualization: KubeVirt (VMs on K8s)
    • Bare Metal: Agent
    • Other: OpenStack (feature-gated), IBM Cloud (PowerVS)
  6. Understand the HyperShift E2E v2 Test Flow

    main

    The HyperShift E2E v2 testing framework follows a multi-phase lifecycle managed by a ci-operator. The process is platform-agnostic, though Azure is currently the reference implementation. The flow consists of four main phases:

    1. CI Job Setup: The ci-operator builds the hypershift-tests image and executes pre-steps (e.g., installing RBAC, setting up the nested management cluster, and installing the HyperShift operator).
    2. Guest Cluster Creation: The create-guests binary is executed. It creates multiple cluster variants (e.g., public, private, oauth-lb, upgrade, autoscaling, external-oidc) in parallel using the hypershift create cluster <platform> command. It waits for all clusters to reach the Available condition and for version rollouts to complete.
    3. Test Execution: The run-tests binary is executed. It reads configuration from a SHARED_DIR and forks multiple test-e2e-v2 subprocesses. Each subprocess targets a specific cluster variant using the E2E_HOSTED_CLUSTER_NAME environment variable and a Ginkgo label filter.
    4. Teardown: The destroy-guests binary is executed to parallelly run hypershift destroy cluster <platform> for all created clusters, followed by destroying the nested management cluster.

    Key binaries available in the hypershift-tests image:

    • test-e2e-v2: The actual test runner.
    • create-guests: Orchestrates cluster creation.
    • run-tests: Orchestrates test execution.
    • destroy-guests: Orchestrates cluster destruction.
    • dump-guests: Collects artifacts from clusters.
  7. Identify the core HyperShift repositories

    main

    HyperShift is distributed across several repositories depending on your needs (core operator, community fork, or specific cloud/plugin integrations).

    • Main Repository: openshift/hypershift contains the HyperShift Operator, Control Plane Operator, CLI, API definitions, and tests.
    • Community Fork: hypershift-community/hypershift is a community-maintained fork synced from the main repository.
    • OADP Plugin: openshift/hypershift-oadp-plugin provides OpenShift API for Data Protection (OADP) support for HostedControlPlane backup and restore.
    • Cloud & Infrastructure Plugins:
      • openshift/aws-encryption-provider: AWS KMS-backed API server encryption.
      • openshift/azure-kubernetes-kms: Azure Key Vault KMS plugin.
      • openshift/apiserver-network-proxy: Konnectivity proxy for secure API server to node communication.
      • openshift/aws-node-termination-handler: Handles EC2 instance shutdown gracefully.
  8. Hosted Clusters on OpenStack Overview

    main

    HyperShift allows the deployment of Hosted Clusters and Nodepools on the OpenStack platform.

    Important Considerations:

    • Support Status: OpenStack support is currently in dev-preview and is intended for development and testing purposes, not production use.
    • Underlying Components: When a HostedCluster is created on OpenStack, HyperShift automatically installs:
      • CAPI Provider for OpenStack (CAPO): Installed in the Hosted Control Plane (HCP) namespace to manage cluster resources.
      • OpenStack Resource Controller (ORC): Installed in the HCP namespace to manage OpenStack resources like Images.
    • Resource Lifecycle: Scaling up a Nodepool triggers the creation of a Machine, which prompts the CAPI provider to create the necessary resources in OpenStack using the Gophercloud SDK.
  9. Deploy HyperShift hosted clusters on Azure

    main

    HyperShift supports two deployment models on Microsoft Azure, depending on your management cluster platform and authentication requirements:

    1. ARO HCP (Managed Azure): Uses an AKS (Azure Kubernetes Service) cluster as the management platform. It utilizes Azure Managed Identities with certificate-based authentication, storing credentials in Azure Key Vault.
    2. Self-Managed Azure: Uses an OpenShift cluster (on any platform) as the management platform. It utilizes Azure Workload Identity with OIDC federation for tokenless authentication. Note that Self-managed Azure HostedClusters are a Developer Preview feature in OpenShift Container Platform 4.21.

    Refer to the specific guides for your chosen model to begin setup.

  10. What is a NodePool in HyperShift

    main

    A NodePool is a scalable set of worker nodes associated with a HostedCluster.

    Key characteristics:

    • Architecture Consistency: All machine architectures within a specific NodePool remain consistent.
    • Independence: The machine architecture of the NodePool is independent of the underlying machine architecture used by the control plane.
    • Scaling: You can control the number of worker nodes by adjusting the replicas field.
  11. What is Konnectivity in HyperShift?

    main

    Konnectivity (also known as apiserver-network-proxy) is a component that facilitates secure network communication between the Kubernetes API server and cluster nodes.

    In HyperShift's hosted control plane architecture, the control plane (e.g., running in a provider VPC) often lacks direct network access to worker nodes (e.g., running in a customer VPC). Konnectivity establishes a tunnel to bridge this gap, allowing the API server to perform tasks like:

    • Obtaining logs of running pods.
    • Executing commands into running pods (exec).
    • Port forwarding pods or services.
    • Accessing aggregated API services and webhooks (e.g., ValidatingWebhookConfiguration, MutatingWebhookConfiguration).

    Note: Konnectivity is not required for traffic initiated from worker nodes to the Kubernetes API server.