The primary CLI tool used to interact with the Kubernetes API is called kubectl
.
The following steps should be done from your local workstation to configure kubectl
to work with your new cluster.
First, download the binary using a command-line tool such as wget
or curl
:
# Replace ${ARCH} with "linux" or "darwin" based on your workstation operating system
$ ARCH=linux; wget https://storage.googleapis.com/kubernetes-release/release/v1.0.3/bin/${ARCH}/amd64/kubectl
After downloading the binary, ensure it is executable and move it into your PATH
:
$ chmod +x kubectl
$ mv kubectl /usr/local/bin/kubectl
Configure your local Kubernetes client using the following commands:
${MASTER_IP}
${CA_CERT}
with the path to the ca.pem
created in previous steps${ADMIN_KEY}
with the path to the admin-key.pem
created in previous steps${ADMIN_CERT}
with the path to the admin.pem
created in previous steps$ kubectl config set-cluster vagrant --server=https://${MASTER_IP}:443 --certificate-authority=${CA_CERT}
$ kubectl config set-credentials vagrant-admin --certificate-authority=${CA_CERT} --client-key=${ADMIN_KEY} --client-certificate=${ADMIN_CERT}
$ kubectl config set-context vagrant --cluster=vagrant --user=vagrant-admin
$ kubectl config use-context vagrant
Check that your client is configured properly by using kubectl
to inspect your cluster:
$ kubectl get nodes
NAME LABELS STATUS
X.X.X.X kubernetes.io/hostname=X.X.X.X Ready