Use this skill when you need to deploy HyperShift clusters on existing Kubernetes clusters using KubeVirt virtualization
This skill provides implementation guidance for creating HyperShift clusters using the KubeVirt provider, which runs on existing Kubernetes clusters with special attention to network conflict prevention and virtual machine management.
This skill is automatically invoked by the /hcp:generate kubevirt command to guide the KubeVirt provider cluster creation process.
The most important aspect of KubeVirt clusters is preventing network conflicts:
Common management cluster ranges to avoid:
Parse the natural language description for KubeVirt-specific requirements:
Environment Type Detection:
Resource Indicators:
Network Requirements:
Storage Requirements:
CRITICAL FIRST STEP: Always check management cluster networks to prevent conflicts.
Prompt for management cluster information:
🔹 **Management Cluster Networks**: To avoid conflicts, please run this command on your management cluster:
`oc get network cluster -o yaml`
From the output, what are the serviceNetwork and clusterNetwork CIDRs?
- serviceNetwork CIDR: [e.g., 172.30.0.0/16]
- clusterNetwork CIDR: [e.g., 10.128.0.0/14]
- [Press Enter if you don't know - I'll use safe defaults]
If user provides management cluster CIDRs:
Required Parameters:
--memory: Memory allocation for VMs (default: 8Gi)--cores: CPU cores for VMs (default: 2)--pull-secret: Path to pull secret file--release-image: OpenShift release imageIPv4 Non-Conflicting Defaults:
--service-cidr: 172.30.0.0/16 (avoids common 10.x ranges)--cluster-cidr: 10.132.0.0/14 (avoids common 10.128.x range)--machine-cidr: 192.168.126.0/24 (avoids common 192.168.1.x range)IPv6 Non-Conflicting Defaults:
--service-cidr: fd02::/112--cluster-cidr: fd01::/48--machine-cidr: fd03::/64Smart Defaults by Environment:
Development Environment:
--memory 8Gi
--cores 2
--control-plane-availability-policy SingleReplica
--node-pool-replicas 2
Production Environment:
--memory 16Gi
--cores 4
--control-plane-availability-policy HighlyAvailable
--node-pool-replicas 3
--auto-repair true
High-Performance Environment:
--memory 32Gi
--cores 8
--control-plane-availability-policy HighlyAvailable
--node-pool-replicas 5
Required Information Collection:
Cluster Name
🔹 **Cluster Name**: What would you like to name your cluster?
- Must be DNS-compatible (lowercase, hyphens allowed)
- Used for VM and resource naming
- Example: dev-cluster, prod-app, test-env
Management Cluster Network Check (see Step 2)
VM Resource Configuration
🔹 **VM Memory**: How much memory should each VM have?
- Development: 8Gi (minimum recommended)
- Production: 16Gi+ (better performance)
- High-performance: 32Gi+ (intensive workloads)
- [Press Enter for default based on environment]
🔹 **VM CPU Cores**: How many CPU cores should each VM have?
- Development: 2 cores (minimum recommended)
- Production: 4+ cores (better performance)
- High-performance: 8+ cores (intensive workloads)
- [Press Enter for default based on environment]
Pull Secret
🔹 **Pull Secret**: Path to your OpenShift pull secret file?
- Required for accessing OpenShift container images
- Download from: https://console.redhat.com/openshift/install/pull-secret
- Example: /home/user/pull-secret.json
OpenShift Version
🔹 **OpenShift Version**: Which OpenShift version do you want to use?
📋 **Check supported versions**: https://amd64.ocp.releases.ci.openshift.org/
- Enter release image URL: quay.io/openshift-release-dev/ocp-release:X.Y.Z-multi
- [Press Enter for default: quay.io/openshift-release-dev/ocp-release:4.18.0-multi]
Optional Configuration:
IPv6 Support (if detected)
🔹 **IPv6 Configuration**: Detected IPv6 requirement. Configure network stack:
- ipv4: IPv4 only (default)
- ipv6: IPv6 only
- dual: Dual-stack (IPv4 + IPv6)
- [Press Enter for default: ipv4]
Storage Class
🔹 **Storage Class**: Which storage class should be used for VM disks?
- List available storage classes on your cluster:
kubectl get storageclass
- [Press Enter to use cluster default]
Node Count
🔹 **Node Pool Replicas**: How many worker nodes do you need?
- Minimum: 2 (for basic redundancy)
- Production recommended: 3+
- [Press Enter for default based on environment type]
If management cluster CIDRs provided, validate conflicts:
## Network Conflict Check
Management cluster networks:
- Service Network: 172.30.0.0/16
- Cluster Network: 10.128.0.0/14
HostedCluster networks (checking for conflicts):
✅ Service CIDR: 172.30.0.0/16 (safe - different range)
❌ Cluster CIDR: 10.132.0.0/14 (CONFLICT with 10.128.0.0/14)
✅ Machine CIDR: 192.168.126.0/24 (safe)
Adjusting Cluster CIDR to avoid conflict:
New Cluster CIDR: 10.140.0.0/14
If no management cluster info provided, use safe defaults:
## Network Configuration (Safe Defaults)
Using safe default CIDRs that avoid common management cluster ranges:
- Service CIDR: 172.30.0.0/16 (avoids 10.x ranges)
- Cluster CIDR: 10.132.0.0/14 (avoids common 10.128.x)
- Machine CIDR: 192.168.126.0/24 (avoids common 192.168.1.x)
Basic KubeVirt Cluster Command:
hypershift create cluster kubevirt \
--name <cluster-name> \
--namespace <cluster-name>-ns \
--memory <memory> \
--cores <cores> \
--pull-secret <pull-secret-path> \
--release-image <release-image> \
--service-cidr <service-cidr> \
--cluster-cidr <cluster-cidr> \
--machine-cidr <machine-cidr>
Development Configuration Example:
hypershift create cluster kubevirt \
--name dev-cluster \
--namespace dev-cluster-ns \
--memory 8Gi \
--cores 2 \
--pull-secret /path/to/pull-secret.json \
--release-image quay.io/openshift-release-dev/ocp-release:4.18.0-multi \
--service-cidr 172.30.0.0/16 \
--cluster-cidr 10.132.0.0/14 \
--machine-cidr 192.168.126.0/24 \
--control-plane-availability-policy SingleReplica \
--node-pool-replicas 2
Production Configuration Example:
hypershift create cluster kubevirt \
--name production-cluster \
--namespace production-cluster-ns \
--memory 16Gi \
--cores 4 \
--pull-secret /path/to/pull-secret.json \
--release-image quay.io/openshift-release-dev/ocp-release:4.18.0-multi \
--service-cidr 172.30.0.0/16 \
--cluster-cidr 10.132.0.0/14 \
--machine-cidr 192.168.126.0/24 \
--control-plane-availability-policy HighlyAvailable \
--node-pool-replicas 3 \
--auto-repair
IPv6 Configuration Example:
hypershift create cluster kubevirt \
--name ipv6-cluster \
--namespace ipv6-cluster-ns \
--memory 16Gi \
--cores 4 \
--pull-secret /path/to/pull-secret.json \
--release-image quay.io/openshift-release-dev/ocp-release:4.18.0-multi \
--service-cidr fd02::/112 \
--cluster-cidr fd01::/48 \
--machine-cidr fd03::/64
Disconnected Configuration Example:
hypershift create cluster kubevirt \
--name airgapped-cluster \
--namespace airgapped-cluster-ns \
--memory 16Gi \
--cores 4 \
--pull-secret /path/to/pull-secret.json \
--release-image quay.io/openshift-release-dev/ocp-release:4.18.0-multi \
--service-cidr 172.30.0.0/16 \
--cluster-cidr 10.132.0.0/14 \
--machine-cidr 192.168.126.0/24 \
--image-content-sources /path/to/image-content-sources.yaml \
--additional-trust-bundle /path/to/ca-bundle.pem \
--render
Provide validation commands:
## Pre-Flight Checks
Before creating the cluster, verify your KubeVirt setup:
1. **KubeVirt Status:**
kubectl get kubevirt -A
2. **Available Storage Classes:**
kubectl get storageclass
3. **Node Resources:**
kubectl top nodes
4. **Available Memory/CPU:**
kubectl describe nodes | grep -E "(Allocatable|Allocated)"
5. **Network Configuration:**
oc get network cluster -o yaml
6. **Required Compute Resources:**
- Control Plane VMs: 3 x (<cores> cores, <memory> RAM)
- Worker VMs: <replica-count> x (<cores> cores, <memory> RAM)
- Total Required: <total-cores> cores, <total-memory> RAM
For Disconnected Environments:
## Post-Creation Configuration (Disconnected)
After running the command above (with --render), you'll need to modify the generated manifests:
1. **Add ImageContentSources to HostedCluster:**
```yaml