Access your Kubernetes Cluster from Ubuntu Desktop

This short guide will show you how to access your Kubernetes Cluster from an External Ubuntu Desktop machine.

Installing Prerequisits:

The first step will be to install the necessary packages to connect to your cluster (kubectl)

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add 
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" >> /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y kubectl

Copying Kubernetes Config from Master:

The next step will be to copy your Kubernetes config from your Kubernetes Master server. SSH to your master and cat the config file.

cat ~/.kube/config

Now, create the directory .kube in your home directory and paste in the content from the master server into a file there named config

mkdir ~/.kube
nano ~/.kube/config

You should now be able to access your cluster and run standard kubectl commands, to test this has worked – Run the below to list your connected nodes:

kubectl get nodes

Any comments or questions? Get in touch here or Email me at [email protected]