Lets say I have two computers; A and B. I created a kubernetes cluster using kops on AWS from computer A. How do I access the API of that cluster (like I do kubectl get nodes
, it gives me the nodes of that cluster) using computer B?
You need to configure kubectl
by defining a configuration file.
Since you are using kops
you can use the instructions they're giving you here:
https://github.com/kubernetes/kops/blob/master/docs/kubectl.md
export KOPS_STATE_STORE=s3://<somes3bucket>
NAME=<kubernetes.mydomain.com>
/path/to/kops export kubecfg ${NAME}
You need to run the above instructions on computer B
and it has to be correctly configured to have access to the <somes3bucket>
bucket.
What the command will do is create a configuration file that holds the URL of your apiserver
and the authentication certificates. If you are on a unix-like environment, that file will be created in $HOME/.kube/config
.