Skip to main content

Overview

Upgrading vCluster involves updating the control plane components, syncing mechanisms, and potentially the virtual Kubernetes version. This guide covers safe upgrade procedures and best practices.

Upgrade Types

vCluster Version

Update vCluster control plane and syncing components

Kubernetes Version

Upgrade the virtual Kubernetes API server version

Configuration Changes

Update vCluster configuration and features

Upgrading vCluster CLI

Before upgrading virtual clusters, update your CLI to the latest version:
vcluster upgrade

Upgrade to Specific Version

vcluster upgrade --version v0.20.0

Verify CLI Version

vcluster --version

Upgrading a Virtual Cluster

Pre-Upgrade Checklist

1

Review Release Notes

Check the vCluster release notes for:
  • Breaking changes
  • New features
  • Known issues
  • Migration guides
2

Create Backup

Always create a snapshot before upgrading:
vcluster snapshot create my-vcluster \
  oci://ghcr.io/my-org/backups:my-vcluster-pre-upgrade-$(date +%Y%m%d) \
  --namespace production
3

Check Current Version

Document the current version:
helm list -n production
vcluster describe my-vcluster --namespace production
4

Plan Maintenance Window

  • Schedule during low-traffic periods
  • Notify stakeholders
  • Prepare rollback plan
  • Have monitoring ready

Standard Upgrade Procedure

# Update Helm repository
helm repo update

# Upgrade vCluster
helm upgrade my-vcluster vcluster \
  --repo https://charts.loft.sh \
  --namespace production \
  --reuse-values
Or upgrade to a specific version:
helm upgrade my-vcluster vcluster \
  --repo https://charts.loft.sh \
  --version 0.20.0 \
  --namespace production \
  --reuse-values

Upgrade with Configuration Changes

If you need to modify configuration during upgrade:
# Export current configuration
vcluster describe my-vcluster --config-only > vcluster.yaml

# Edit vcluster.yaml with desired changes
vim vcluster.yaml

# Upgrade with new configuration
helm upgrade my-vcluster vcluster \
  --repo https://charts.loft.sh \
  --namespace production \
  --values vcluster.yaml

Post-Upgrade Verification

1

Check Pod Status

Verify all pods are running:
kubectl get pods -n production -l release=my-vcluster
Wait for all pods to reach Running state:
kubectl wait --for=condition=ready pod \
  -l app=vcluster,release=my-vcluster \
  -n production \
  --timeout=300s
2

Verify API Server

Test connectivity to the virtual cluster:
vcluster connect my-vcluster --namespace production
kubectl get nodes
kubectl get pods --all-namespaces
3

Check Syncing

Verify resources are syncing correctly:
# From virtual cluster context
kubectl create deployment test-nginx --image=nginx

# Check if it appears in host namespace
vcluster disconnect
kubectl get pods -n production | grep nginx

# Clean up
vcluster connect my-vcluster --namespace production
kubectl delete deployment test-nginx
4

Review Logs

Check for any errors or warnings:
kubectl logs -n production -l app=vcluster,release=my-vcluster --tail=100
5

Run Smoke Tests

Execute your application-specific health checks and tests.

Upgrading Kubernetes Version

To upgrade the virtual Kubernetes version:
# vcluster.yaml
controlPlane:
  distro:
    k8s:
      enabled: true
      version: "1.29.0"  # Specify desired version
Apply the upgrade:
helm upgrade my-vcluster vcluster \
  --repo https://charts.loft.sh \
  --namespace production \
  --values vcluster.yaml
Kubernetes version upgrades should be done incrementally (e.g., 1.27 → 1.28 → 1.29). Skipping versions may cause compatibility issues.

Rollback Procedures

If the upgrade fails or causes issues:

Helm Rollback

# View upgrade history
helm history my-vcluster -n production

# Rollback to previous version
helm rollback my-vcluster -n production

# Or rollback to specific revision
helm rollback my-vcluster 2 -n production

Snapshot Restore Rollback

For major issues, restore from pre-upgrade snapshot:
# Restore from backup
vcluster restore my-vcluster \
  oci://ghcr.io/my-org/backups:my-vcluster-pre-upgrade-20240115 \
  --namespace production

Upgrade Strategies

Blue-Green Upgrade

Minimize downtime with blue-green deployment:
1

Create Green Cluster

vcluster create my-vcluster-green --namespace production-green
2

Restore Data

vcluster restore my-vcluster-green \
  oci://ghcr.io/my-org/backups:my-vcluster-latest \
  --namespace production-green
3

Test Green Cluster

vcluster connect my-vcluster-green --namespace production-green
# Run tests
4

Switch Traffic

Update ingress or service endpoints to point to green cluster.
5

Monitor

Watch for issues. Keep blue cluster running for quick rollback.
6

Decommission Blue

After verification period:
vcluster delete my-vcluster --namespace production

Canary Upgrade

Gradually migrate workloads:
1

Create Canary Cluster

Deploy upgraded version alongside production:
vcluster create my-vcluster-canary \
  --namespace production-canary \
  --values vcluster-v0.20.yaml
2

Route Small Percentage

Configure load balancer to send 10% of traffic to canary.
3

Monitor Metrics

Compare performance and error rates between versions.
4

Gradually Increase

Incrementally increase traffic to canary: 10% → 25% → 50% → 100%
5

Complete Migration

Once validated, make canary the primary cluster.

Automated Upgrades

Renovate Bot Configuration

Automate Helm chart updates with Renovate:
{
  "extends": ["config:base"],
  "helm-values": {
    "fileMatch": [".*\\.ya?ml$"]
  },
  "packageRules": [
    {
      "matchDatasources": ["helm"],
      "matchPackageNames": ["vcluster"],
      "groupName": "vCluster",
      "automerge": false,
      "schedule": ["before 6am on monday"]
    }
  ]
}

GitOps-Based Upgrades

Using ArgoCD or Flux:
# argocd-application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-vcluster
  namespace: argocd
spec:
  source:
    repoURL: https://charts.loft.sh
    targetRevision: 0.20.0  # Update this to trigger upgrade
    chart: vcluster
    helm:
      values: |
        # Your vcluster values
  destination:
    server: https://kubernetes.default.svc
    namespace: production
  syncPolicy:
    automated:
      prune: false
      selfHeal: true

Troubleshooting Upgrades

Symptoms: Virtual cluster pods won’t start after upgrade.Diagnosis:
kubectl describe pod -n production -l release=my-vcluster
kubectl get events -n production --sort-by='.lastTimestamp'
Common Causes:
  • Insufficient resources
  • Image pull errors
  • PVC mount issues
Solutions:
  1. Check resource availability:
    kubectl top nodes
    kubectl describe node <node-name>
    
  2. Verify image access:
    kubectl get pods -n production -l release=my-vcluster -o jsonpath='{.items[*].spec.containers[*].image}'
    
  3. Check PVC status:
    kubectl get pvc -n production
    
Symptoms: Cannot connect to virtual cluster after upgrade.Diagnosis:
kubectl logs -n production -l app=vcluster,release=my-vcluster
kubectl get svc -n production
Solutions:
  1. Restart the virtual cluster:
    kubectl rollout restart statefulset -n production my-vcluster
    
  2. Check service endpoints:
    kubectl get endpoints -n production
    
  3. Verify network policies:
    kubectl get networkpolicy -n production
    
Symptoms: Resources not syncing between virtual and host cluster.Diagnosis:
# Check syncer logs
kubectl logs -n production -l app=vcluster,release=my-vcluster -c syncer

# Check RBAC
kubectl auth can-i --list --as=system:serviceaccount:production:vc-my-vcluster
Solutions:
  1. Verify sync configuration in vcluster.yaml
  2. Check service account permissions
  3. Review network connectivity between pods
  4. Restart syncer:
    kubectl delete pod -n production -l app=vcluster,release=my-vcluster
    
Error: CRD versions incompatible after upgrade.Solution:
  1. Identify conflicting CRDs:
    kubectl get crd
    
  2. Update CRDs manually if needed:
    kubectl apply -f https://github.com/loft-sh/vcluster/releases/download/v0.20.0/crds.yaml
    
  3. Or use Helm’s CRD upgrade:
    helm upgrade my-vcluster vcluster \
      --repo https://charts.loft.sh \
      --namespace production \
      --reuse-values \
      --force
    

Best Practices

Test in Staging First

Always test upgrades in non-production environments before applying to production.

Incremental Updates

Upgrade one minor version at a time to minimize compatibility issues.

Backup Before Upgrade

Create snapshots before every upgrade. Automate this step.

Monitor During Upgrade

Watch metrics and logs during and after the upgrade process.

Document Everything

Keep records of upgrade procedures, issues encountered, and resolutions.

Plan Rollback

Always have a tested rollback plan before starting an upgrade.

Next Steps

Monitoring

Set up monitoring to track upgrade success and cluster health

Troubleshooting

Learn how to diagnose and fix common issues