Access Using kubeconfig
The recommended way to access a KubeRaya cluster is by using a kubeconfig file.
A kubeconfig file contains the authentication and endpoint information required to securely connect to the Kubernetes API (control plane).
This guide walks you through downloading, configuring, and verifying access to your KubeRaya cluster using kubectl.
What Is kubeconfig?
A kubeconfig file is a YAML configuration file used by Kubernetes clients.
It defines:
- Cluster API endpoint
- Certificate authority
- Authentication credentials
- Context and user mapping
CloudRaya automatically generates a ready-to-use kubeconfig for each Kubernetes cluster.
No manual certificate or credential setup is required.
Prerequisites
Before you begin, make sure:
- You have an active KubeRaya cluster
- You have access to the CloudRaya dashboard
kubectlis installed on your local machine
📄 kubectl installation:
https://kubernetes.io/docs/tasks/tools/
Step 1: Download the kubeconfig File
You can download the kubeconfig file from the CloudRaya dashboard.
Option A: From the Cluster List
- Open Dashboard → Compute → KubeRaya
- Locate your cluster
- Click the action menu
- Select Download Config File
Option B: From Cluster Detail Page
- Open Dashboard → Compute → KubeRaya
- Click View Detail on the cluster
- Click Download Config
The file will be downloaded to your local machine (usually named something like config or kubernetes.conf).
Step 2: Place the kubeconfig File
kubectl looks for kubeconfig files in a default location.
Default Location (Recommended)
Move the downloaded file to:
~/.kube/configIf the directory does not exist, create it:
mkdir -p ~/.kubeThen move the file:
mv ~/Downloads/config ~/.kube/configIf you already have an existing kubeconfig, see Using Multiple kubeconfig Files below.
Step 3: Verify Cluster Access
Once the kubeconfig file is in place, verify access using kubectl.
Check Cluster Connectivity
kubectl cluster-infoExpected result:
- Kubernetes control plane endpoint is reachable
- No authentication errors
List Nodes
kubectl get nodesYou should see:
- One or more master nodes (control plane)
- One or more worker nodes
This confirms that your local machine is successfully connected to the KubeRaya cluster.
Step 4: Verify Current Context
A kubeconfig file can contain multiple clusters and contexts.
Check the active context:
kubectl config current-contextList available contexts:
kubectl config get-contextsIf needed, switch context:
kubectl config use-context <context-name>Using Multiple kubeconfig Files (Advanced)
If you manage multiple clusters, you can keep separate kubeconfig files.
Option 1: Use KUBECONFIG Environment Variable
export KUBECONFIG=~/kubeconfigs/cluster1.yamlOption 2: Merge kubeconfig Files
export KUBECONFIG=~/.kube/config:~/kubeconfigs/cluster2.yaml
kubectl config view --merge --flatten > ~/.kube/configThis approach is commonly used by teams managing multiple environments.
Security Best Practices
kubeconfig files grant administrative access to your cluster.
Follow these best practices:
- Store kubeconfig files securely
- Do not upload kubeconfig files to public repositories
- Do not share kubeconfig files over chat or email
- Regenerate kubeconfig if credentials are exposed
- Restrict access at the operating system level
📄 See: Kubernetes Security Basics
Common Issues & Troubleshooting
Connection Refused or Timeout
- Ensure the cluster status is Running
- Verify network connectivity
- Check firewall or VPN configuration if applicable
Authentication Errors
- Re-download the kubeconfig file
- Ensure the correct context is active
- Confirm the file has not been modified
Wrong Cluster Accessed
- Check current context
- Switch context explicitly
When to Use kubeconfig Access
Use kubeconfig access for:
- Application deployment
- Cluster administration
- CI/CD pipelines
- Debugging workloads
- Production operations
This is the standard and most reliable access method.