After we created a cluster in iMKE, it is time to connect to it. This is necessary to deploy and manage our applications.
To find a cluster, we need to go to the detail view of the cluster. For that, we click on the entry
We click on the downwards facing arrow in the top right corner:
This way we download a file which is called
kubeconfig in Kubernetes jargon. This file contains all end points, certificates and other information about the cluster. The
kubectlcommand uses this file to connect to the cluster.
To use the
kubeconfig, we need to register it on the console. There are two ways to do this:
kubectlby default tries to use the file
.kube/configin your home directory.
- We can temporarily use the
kubeconfigby exporting it to an environment variable.
To keep things straightforward and to avoid changing standards on our system, we choose the second method in the example.
For this we need to open a Terminal. In the screenshots we use iTerm2 on macOS, but the examples work the same way when using bash on Linux or Windows.
First, we need to find the downloaded
kubeconfig file. Browsers like Chrome or Firefox usually store it in the Downloads folder. The name is constructed from two parts:
- plus the cluster id.
To register the
kubeconfig, we use the following command:
cd Downloads export KUBECONFIG=$(pwd)/kubeconfig-admin-CLUSTERID
Now we can interact with the cluster. The simplest command is: “show all the nodes that comprise my cluster”:
kubectl get nodes NAME STATUS ROLES AGE VERSION musing-kalam-XXXXXXXXX-ks4xz Ready <none> 10m v1.20.7 musing-kalam-XXXXXXXXX-txc4w Ready <none> 10m v1.20.7 musing-kalam-XXXXXXXXX-vc4g2 Ready <none> 10m v1.20.7
In iMKE we can access the Kubernetes Dashboard with one click. We only need to click on the
Open Dashboard button on the top right of the cluster view:
Now we see the Kubernetes Dashboard and can explore our cluster graphically:
By completing this guide you’ve learned the following:
- How to get the
- How to configure
kubectlto use the
- How to access the Kubernetes Dashboard for a cluster
Congratulations! Now you know all that’s needed to connect to a Kubernetes Cluster.