Accessing Kubernetes Cluster via CLI
Kubernetes CLI access allows you to interact with your cluster directly from the terminal using kubectl. This is useful for inspecting, managing, and troubleshooting resources running in your cloud environment via UzCloud.
Download Kubeconfig for the Cluster
The kubectl command-line tool uses kubeconfig files to find the information it needs to choose a cluster and communicate with the API server of a cluster.
- Open your cluster on the Kubernetes page and click Download Config to download the kubeconfig file.
Download kubectl Tool
Download the kubectl binary matching your cluster’s Kubernetes version (the links below are for v1.27.3; replace the version in the URL if your cluster runs a different one):
Use kubectl With Your Kubeconfig File
You can now run kubectl commands using your downloaded kubeconfig file.
kubectl --kubeconfig /custom/path/kube.conf {COMMAND}
- List Pods:
kubectl --kubeconfig /custom/path/kube.conf get pods --all-namespaces
- List Nodes:
kubectl --kubeconfig /custom/path/kube.conf get nodes --all-namespaces
- List Services:
kubectl --kubeconfig /custom/path/kube.conf get services --all-namespaces
Conclusion
By following this guide, you can set up and use the kubectl CLI to manage your Kubernetes clusters via UzCloud. This method provides a powerful and flexible way to interact with cluster resources directly from your terminal.