Configuring Kubectl to Access a Remote Cluster

Hands-On Lab

Will Boyd

DevOps Team Lead in Content

Length

01:00:00

Difficulty

Intermediate

Kubectl is a powerful tool for managing a Kubernetes cluster. While kubectl can be used from one of the servers that makes up your cluster, it can also be used from your local command line to manage the cluster remotely. In this learning activity, you will configure kubectl on one machine to interact with a Kubernetes cluster on another machine. After completing this activity, you will have hands-on experience in configuring kubectl to connect to a cluster remotely.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Learn By Doing

Configuring Kubectl to Access a Remote Cluster

Introduction

In this lab, we'll configure kubectl on one machine to interact with a Kubernetes cluster on another machine. After completing this lab, you will have hands-on experience in configuring kubectl to connect to a cluster remotely.

We’ll use the Workspace server to represent your local workstation. This is the server you will need to log in to so you can configure kubectl. Kubectl is already installed, so you do not need to install it manually.

Open a terminal window and log in via SSH to the Workspace server using the public IP and credentials provided on the lab page.

Set the kubectl Cluster Data

First, set KUBERNETES_PUBLIC_ADDRESS to the public IP of the Controller server on the lab page: