Local kubectl access Remote Kubernetes Cluster

You can setup kubernetes cluster from remote client.

This article has the following node:

  • Kubernetes cluster (, a master node)
  • Kubernetes cluster is bootstraping with kubeadm
  • Kubernetes client (, separate from the cluster)

The first step to configure the client is installing the kubectl client:

sudo apt install -y apt-transport-https; curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
nano kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main

sudo mv kubernetes.list /etc/apt/sources.list.d/kubernetes.list
sudo apt update; sudo apt install -y kubectl

SCP the .kube folder from master into client node

scp -r btech@ .kube

Check from the client

btech@zu-kubernetes-client:~$ kubectl get nodes
zu-master    Ready    master   20d   v1.13.3
zu-worker1   Ready    <none>   20d   v1.13.3
zu-worker2   Ready    <none>   20d   v1.13.3
zu-worker3   Ready    <none>   20d   v1.13.3
btech@zu-kubernetes-client:~$ kubectl get deployment
NAME                   READY   UP-TO-DATE   AVAILABLE   AGE
doc-contoh-1           10/10   10           10          4d19h
past-deployment-prod   2/2     2            2           5d17h

Comments are closed.