KubeVela Core Multi-Cluster IDE Debugging Guide
This guide walks you through setting up a multicluster KubeVela environment (hub-and-spoke architecture) for debugging the core controller from your IDE.
Prerequisites
- k3d installed
- kubectl configured
- KubeVela source code
- IDE with debugging capabilities (e.g., GoLand, VS Code)
Part 1: Hub Cluster Setup
Step 1: Create Hub Cluster
# Command Format:
k3d cluster create {clustername}
# Example:
k3d cluster create hub
Step 2: Export Kubeconfig
# Command Format:
k3d kubeconfig get {clustername} > ~/.kube/{clustername}.yaml
export KUBECONFIG=~/.kube/{clustername}.yaml
# Example:
k3d kubeconfig get hub > ~/.kube/hub.yaml
export KUBECONFIG=~/.kube/hub.yaml
Step 3: Install Core Components
make core-install
make def-install
Part 2: Configure Webhook Debugger
Step 4: Update Debugger Script
Edit the setup-webhook-debugger.sh script and update the kubeconfig location:
#--- STEP 10: Export KUBECONFIG ------------------------------------------------
echo "==> STEP 10: Export KUBECONFIG"
export KUBECONFIG="${HOME}/.kube/hub.yaml"
echo "Using KUBECONFIG=${KUBECONFIG}"
Step 5: Run Debugger Setup
./setup-webhook-debugger.sh
Part 3: IDE Configuration
Step 6: Configure Environment Variables
In your IDE's build/debug configuration, add the following environment variable:
# Format:
KUBECONFIG={path-to-hub-kubeconfig}
# Example:
KUBECONFIG=/Users/viskumar/.kube/hub.yaml
Replace the path with the actual location of your hub cluster's kubeconfig file.
Why is this needed?
When the core controller runs in your IDE, it needs to know which cluster to connect to. The KUBECONFIG environment variable tells the controller to use the hub cluster's configuration.
Step 7: Start the IDE in Debug Mode
Launch your IDE debugger. The core controller will now run from your IDE instead of in-cluster.
Part 4: Install Cluster Gateway
Understanding Cluster Gateway
Why do we need Cluster Gateway?
In a multicluster setup, Cluster Gateway is the critical component that enables:
- Communication between the hub cluster and spoke clusters
- Routing of API requests to remote clusters
- Centralised management of multiple Kubernetes clusters
- Secure authentication and authorisation across clusters
Why run the core controller from the IDE while keeping the Cluster Gateway in-cluster?
When debugging KubeVela core, we want to:
✅ Run the core controller from the IDE (so we can debug it with breakpoints)
✅ Keep Cluster Gateway running in-cluster (it needs to be accessible as a service endpoint for multicluster communication)
This is why we install only Cluster Gateway via Helm while the core controller runs in your IDE.
Step 8: Prepare Helm Chart
Navigate to the Helm chart templates directory:
# Command Format:
cd {path-to-kubevela}/charts/vela-core/templates
# Example:
cd kubevela/charts/vela-core/templates
Why delete other templates?
The Vela-core Helm chart normally installs:
- Core controller deployment (we DON'T want this - it's running in our IDE)
- Cluster Gateway deployment (we NEED this for multicluster)
- Webhooks and other components (we DON'T need these for debugging)
By deleting everything except Cluster Gateway components, we ensure:
- No conflict between the in-cluster controller and the IDE controller
- Only the necessary multicluster infrastructure is deployed
- Clean separation of the debugging environment
Files to KEEP (delete everything else):
✅ cluster-gateway/ (entire folder) - Cluster Gateway deployment and services
✅ _helpers.tpl - Helm template helpers required by other templates
✅ kubevela-controller.yaml - Core controller service account and RBAC (needs modification - see below)
✅ addon_registry.yaml - Addon registry configuration
✅ NOTES.txt - Post-installation notes
Files/Folders to DELETE:
❌ All webhook-related templates
❌ Application controller templates
❌ Any other deployment or pod templates
❌ Other service templates not related to Cluster Gateway
⚠️ Important: Modify kubevela-controller.yaml
Open kubevela-controller.yaml and remove the following definitions:
❌ Deployment - Delete the entire Deployment resource (the controller will run in your IDE)
❌ Service - Delete the Service resource (not needed when controller runs locally)
❌ ServiceMonitor - Delete ServiceMonitor resource if present (monitoring not needed for debugging)
Keep ONLY the RBAC resources:
✅ ServiceAccount - Keep this (controller needs identity)
✅ ClusterRole - Keep this (defines permissions)
✅ ClusterRoleBinding - Keep this (grants permissions to ServiceAccount)