Skip to content

This repo contains a Helm chart that deploys vcluster using Cluster API (CAPI) for creating lightweight, isolated Kubernetes clusters within your main cluster.

Notifications You must be signed in to change notification settings

ITlusions/ITL.K8s.CAPI

Repository files navigation

ITL Kubernetes Cluster API (CAPI) Helm Chart

Test Chart Release Chart Dependency Updates

This Helm chart deploys vcluster using Cluster API (CAPI) for creating lightweight, isolated Kubernetes clusters within your main cluster.

Prerequisites

  • Kubernetes cluster (1.19+)
  • Helm 3.0+
  • Cluster API (CAPI) installed with vcluster provider
  • kubectl configured to access your management cluster

Installation

1. Initialize Cluster API (One-time setup)

# Install clusterctl (if not already installed)
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/latest/download/clusterctl-windows-amd64.exe -o clusterctl.exe

# Initialize Cluster API with vcluster provider
clusterctl init --infrastructure vcluster

# Verify installation
kubectl get pods -n capi-system
kubectl get pods -n capi-vcluster-system

2. Deploy the Helm Chart

Development Deployment

# Create namespace
kubectl create namespace vcluster-dev

# Deploy for development
helm install dev-vcluster . \
  --namespace vcluster-dev \
  --values values-development.yaml \
  --wait

# Get kubeconfig for the vcluster
kubectl get secret dev-workload-kubeconfig -n vcluster-dev -o jsonpath='{.data.kubeconfig}' | base64 -d > dev-kubeconfig.yaml
export KUBECONFIG=dev-kubeconfig.yaml

Production Deployment

# Create namespace
kubectl create namespace vcluster-prod

# Deploy for production
helm install prod-vcluster . \
  --namespace vcluster-prod \
  --values values-production.yaml \
  --wait

# Get kubeconfig for the vcluster
kubectl get secret prod-workload-kubeconfig -n vcluster-prod -o jsonpath='{.data.kubeconfig}' | base64 -d > prod-kubeconfig.yaml
export KUBECONFIG=prod-kubeconfig.yaml

3. Custom Deployment

# Create your own values file
cp values.yaml my-values.yaml

# Edit my-values.yaml with your specific configuration
# Then deploy
helm install my-vcluster . \
  --namespace my-namespace \
  --values my-values.yaml \
  --wait

Configuration

Key Configuration Options

Parameter Description Default
global.environment Environment name production
vcluster.name Name of the vcluster workload-cluster
vcluster.namespace Namespace for vcluster vcluster-system
vcluster.cluster.kubernetesVersion Kubernetes version v1.31.2
externalAccess.enabled Enable external access false
externalAccess.type Service type for external access LoadBalancer
monitoring.enabled Enable monitoring false
highAvailability.enabled Enable HA configuration false

Storage Configuration

vcluster:
  helmRelease:
    values:
      storage:
        persistence: true
        size: "20Gi"
        storageClass: "premium-ssd"

External Access via Ingress

externalAccess:
  enabled: true
  type: Ingress
  ingress:
    enabled: true
    host: vcluster.example.com
    tls:
      enabled: true
      secretName: vcluster-tls
    annotations:
      kubernetes.io/ingress.class: nginx
      cert-manager.io/cluster-issuer: letsencrypt-prod

High Availability

highAvailability:
  enabled: true
  affinity:
    podAntiAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
          - key: app
            operator: In
            values:
            - vcluster
        topologyKey: kubernetes.io/hostname

Monitoring

Enable monitoring to integrate with Prometheus:

monitoring:
  enabled: true
  serviceMonitor:
    enabled: true
    namespace: monitoring

Troubleshooting

Check Cluster Status

# Check clusters
kubectl get clusters -n <namespace>

# Check vclusters
kubectl get vclusters -n <namespace>

# Check pods
kubectl get pods -n <namespace>

View Logs

# View vcluster controller logs
kubectl logs -n capi-vcluster-system -l control-plane=controller-manager

# View specific vcluster logs
kubectl logs -n <namespace> -l app=vcluster

Access vcluster

# Get kubeconfig
kubectl get secret <cluster-name>-kubeconfig -n <namespace> -o jsonpath='{.data.kubeconfig}' | base64 -d > vcluster-kubeconfig.yaml

# Use the kubeconfig
export KUBECONFIG=vcluster-kubeconfig.yaml
kubectl get nodes

Upgrading

# Upgrade the chart
helm upgrade <release-name> . \
  --namespace <namespace> \
  --values <values-file> \
  --wait

# Check upgrade status
helm status <release-name> -n <namespace>

Uninstalling

# Uninstall the chart
helm uninstall <release-name> -n <namespace>

# Clean up resources (if needed)
kubectl delete namespace <namespace>

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test the changes
  5. Submit a pull request

Support

For issues and questions:

About

This repo contains a Helm chart that deploys vcluster using Cluster API (CAPI) for creating lightweight, isolated Kubernetes clusters within your main cluster.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages