Difficulty: 1/5
This exercise will teach you how to use the kubectl karbon plugin to easily get NKE Cluster kubeconfig file without having to get it from the Prism Central GUI.
- A Nutanix cluster with Prism Central with NKE activated
- A NKE cluster deployed
- A prism account with rights on NKE
- kubectl installed on your laptop
- Recommended : have
brew
installed on your laptop
A great plugin exists for kubectl to directly get the kubeconfig file from Prism Central to connect to your NKE cluster, without having to use the Prism Central web interface.
-
Install the karbon plugin from https://github.com/nutanix/kubectl-karbon
Answer
- Look at the installation options on the github repo, and choose the preferred one
- Install the plugin. For example
brew install nutanix/tap/kubectl-karbon
-
With this plugin, get kubeconfig file from your NKE cluster
Answer
-
Execute command
kubectl karbon login --server <Prism Central IP or FQDN> --user <your user>
Note: you can also use
--insecure
if your PC does not have valid certificate--force
if you already have an old kubeconfig file--kubie
to use kubeconfig file with kubie
-
Enter your password when prompted
-
Select your cluster name with arrows up and down
Note: you can also enter some characters to filter cluster list
-
Validate with 'Enter' key
-
Your kubeconfig file is now downloaded and applied (for this session shell only)
-
-
Check connection with your kubernetes cluster
Answer
- Launch any kubectl command. For example :
kubectl cluster-info
- If you get an answer, your are good !
- Launch any kubectl command. For example :
- Rather than using NKE GUI to get kubeconfig file for your NKE cluster, you can use a kubectl plugin to easily get kubeconfig file.