Documentation Index
Fetch the complete documentation index at: https://mintlify.com/loft-sh/vcluster/llms.txt
Use this file to discover all available pages before exploring further.
Synopsis
Connects to an existing virtual cluster by updating your kubeconfig.Description
Theconnect command updates your kubectl context to point to the specified virtual cluster. It can also execute commands directly within the vCluster context.
Examples
Basic Connection
Execute Commands
Background Connection
Flags
The Kubernetes namespace where the vCluster is running.
The driver to use. Options:
helm, platform, docker.Path to kubeconfig file to update. Defaults to
$KUBECONFIG or ~/.kube/config.The server to connect to. If not specified, uses port-forwarding.
Service account name to use for authentication.
Skip TLS certificate verification.
Start port-forwarding as a background process.
Use an existing port-forward instead of starting a new one.
The local port to use for port-forwarding.
Print the kubeconfig to stdout instead of updating the file.
Custom name for the kubeconfig context.
Platform Flags
[PLATFORM] The vCluster Platform project name.
Connection Methods
vCluster supports multiple connection methods:1. Port-Forwarding (Default)
The default and most compatible method. Creates a local port-forward to the vCluster:- Works from anywhere with kubectl access
- No additional infrastructure needed
- Secure (uses existing k8s authentication)
- Requires active connection
- Additional latency
2. Direct Connection
Connect directly using a LoadBalancer or Ingress:- Lower latency
- No local port-forwarding needed
- Better for CI/CD
- Requires LoadBalancer or Ingress
- Must manage certificates
3. Service Account Token
Use a service account for non-interactive authentication:Complete Examples
CI/CD Pipeline
ci-pipeline.sh
Development Workflow
Print Kubeconfig Only
Output
Successful connection output:Troubleshooting
Port already in use
Port already in use
If the local port is already in use:
Connection timeout
Connection timeout
Check if the vCluster is running:
Certificate errors
Certificate errors
For certificate issues with direct connections:
Context not switching
Context not switching
Manually switch context:
Disconnecting
To disconnect from a vCluster and return to your previous context:See Also
- vcluster create - Create a new vCluster
- vcluster list - List all vClusters