v1.0
Managed Kubernetes
PMK Onboarding
Networking / Ingress
Storage
Data Services
Automating PMK
Troubleshooting

Kubectl

Kubectl is the Kubernetes command-line tool, that enables you to run commands against your Kubernetes clusters. Kubectl is one of the first tools you would want configured once you have a Kubernetes cluster, so you can start deploying sample applications on Kubernetes.

You can use kubectl to deploy your containerized applications, inspect and manage cluster resources, view container logs to debug issues etc.

Step 1 - Install Kubectl

Follow the steps to download and install kubectl on your local machine to access your Kubernetes cluster.

  1. On an Ubuntu local machine, use this article for Steps to Install kubectl on Ubuntu using Apt.
  2. If you are running any other operating system, This Documentation provides OS specific instructions.

Step 2 - Configure Kubectl to access your Kubernetes Cluster

Now that you have kubectl installed, you need to get a valid kubeconfig file for your Kubernetes cluster and then configure kubectl to work with the kubeconfig file, so it can access your Kubernetes cluster.

If using a Platform9 Managed Kubernetes (PMK) Cluster:

  • Login to the Platform9 UI and access the "API Access tab" on the left menu of the Platform9 UI.
  • Select an option to generate a kubeconfig file for your cluster and download the resulting file.

If using a different Kubernetes cluster, talk to your cluster administrator to get access to a valid kubeconfig file.

To ensure your local environment is set up to connect to your Kubernetes cluster, run the following command to set up your KUBECONFIG environment variable.

Bash
Copy

Step 3 - Verify Connection

Verify that the kubeconfig was set up successfully and kubectl can connect to your Kubernetes cluster:

Bash
Copy

You should see output like this:

Bash
Copy

Now you have kubectl installed and configured to work with your Kubernetes cluster.

For more information, including a comprehensive list of kubectl operations, see the Kubectl Reference Documentation.

  Last updated