Kubernetes cluster access
Overview
This guide explains how to connect to an OpenCRVS Kubernetes cluster using kubectl.
Cluster access is provided using a Kubernetes kubeconfig file generated by the cluster administrator.
Quick Start
Copy the Kubernetes configuration file (kubeconfig) from the server:
scp -P 22 -i ~/.ssh/id_rsa <login>@<server>:~/.kube/config /tmp/kubeconfigVerify cluster access:
export KUBECONFIG=/tmp/kubeconfig kubectl get namespaces
If the command succeeds, your Kubernetes access is configured correctly.
Prerequisites
Before connecting to the cluster, ensure you have:
SSH access to the server
kubectlinstalled locally [2]VPN or network access to the cluster (if required)
Network access to Kubernetes API port
6443/TCP
Optional utilities:
Access cluster from the server (SSH)
The Kubernetes kubeconfig file is stored in the user's home directory on the server (Kubernetes master node):
Users defined in the infrastructure inventory files (environments/<env>/inventory.yaml) already have Kubernetes access configured.
After connecting to the server via SSH, use kubectl or k9s to manage and troubleshoot OpenCRVS workloads. Both tools are installed and configured by default.
Use kubectl from your laptop
Copy kubeconfig from the server
Copy the Kubernetes kubeconfig file from the server to your laptop:
Configure kubeconfig for long-term use
Most users only need one of the following options.
Option 1: Replace your default kubeconfig
Use this option if the cluster should become your default and only Kubernetes context:
This will overwrite your existing ~/.kube/config file.
Option 2: Merge with an existing kubeconfig
Use this option if you already work with multiple Kubernetes clusters:
Useful commands
List available Kubernetes contexts
Example output:
Switch Kubernetes context
Example output:
Verify cluster connection
Common troubleshooting commands
Check current Kubernetes context:
Check cluster connectivity:
Check Kubernetes API permissions:
Links
[1] https://kubernetes.io/docs/reference/kubectl/quick-reference/
[2] https://kubernetes.io/docs/tasks/tools/
[3] https://helm.sh/
Last updated