Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.85 KB

04-kubectl.md

File metadata and controls

65 lines (45 loc) · 1.85 KB

Configuring the Kubernetes Client - Remote Access

Run the following commands from the machine which will be your Kubernetes Client

Download and Install kubectl

OS X

wget https://storage.googleapis.com/kubernetes-release/release/v1.7.6/bin/darwin/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin

Linux

wget https://storage.googleapis.com/kubernetes-release/release/v1.7.6/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin

Note: On CoreOS the above directory is read only, therefore you might want to use a different path.

sudo mkdir -p /opt/bin/
sudo mv kubectl /opt/bin/
export PATH=$PATH:/opt/bin

Configure Kubectl

In this section you will configure the kubectl client to point to the Kubernetes API Server Frontend Load Balancer.

Use the load balancer's floating ip from earlier:

export KUBERNETES_PUBLIC_ADDRESS=10.47.40.33

Also be sure to locate the CA certificate created earlier. Since we are using self-signed TLS certs we need to trust the CA certificate so we can verify the remote API Servers.

Build up the kubeconfig entry

The following commands will build up the default kubeconfig file used by kubectl.

kubectl config set-cluster kubernetes-the-hard-way \
  --certificate-authority=ca.pem \
  --embed-certs=true \
  --server=https://${KUBERNETES_PUBLIC_ADDRESS}

kubectl config set-credentials admin \
  --embed-certs=true \
  --client-certificate=admin.pem \
  --client-key=admin-key.pem

kubectl config set-context kubernetes-the-hard-way \
  --cluster=kubernetes-the-hard-way \
  --user=admin

kubectl config use-context kubernetes-the-hard-way

Once you have created the master nodes, you should be able to connect securly to the remote API server.