Guides - Download Your kubeconfig

Linode Kubernetes Engine (LKE) is a fully-managed container orchestration engine for deploying and managing containerized applications and workloads. LKE combines Linode’s ease of use and simple pricing with the infrastructure efficiency of Kubernetes. You can now get your infrastructure and workloads up and running in minutes instead of days.

Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

Anytime after your cluster is created you can download its kubeconfig. The kubeconfig is a YAML file that will allow you to use kubectl to communicate with your cluster. Here is an example kubeconfig file:

File: example-cluster-kubeconfig.yaml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
apiVersion: v1
kind: Config
preferences: {}

clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUd...
    server: https://example.us-central.linodelke.net:443
  name: lke1234

users:
- name: lke1234-admin
  user:
    as-user-extra: {}
    token: LS0tLS1CRUd...

contexts:
- context:
    cluster: lke1234
    namespace: default
    user: lke1234-admin
  name: lke1234-ctx

current-context: lke1234-ctx

This configuration file defines your cluster, users, and contexts.

  1. To access your cluster’s kubeconfig, log into your Cloud Manager account and navigate to the Kubernetes section.

  2. From the Kubernetes listing page, click on your cluster’s more options ellipsis and select Download kubeconfig. The file will be saved to your computer’s Downloads folder.

    You can also download the kubeconfig from the Kubernetes cluster’s details page.

    1. When viewing the Kubernetes listing page, click on the cluster for which you’d like to download a kubeconfig file.

    2. On the cluster’s details page, under the kubeconfig section, click the Download icon. The file will be saved to your Downloads folder.

    3. To view the contents of your kubeconfig file, click on the View icon. A pane will appear with the contents of your cluster’s kubeconfig file.

  3. To improve security, change the kubeconfig.yaml file permissions to be only accessible by the current user:

     chmod go-r /Downloads/kubeconfig.yaml
    
  4. Open a terminal shell and save your kubeconfig file’s path to the $KUBECONFIG environment variable. In the example command, the kubeconfig file is located in the Downloads folder, but you should alter this line with this folder’s location on your computer:

     export KUBECONFIG=~/Downloads/kubeconfig.yaml
    
    Note
    It is common practice to store your kubeconfig files in ~/.kube directory. By default, kubectl will search for a kubeconfig file named config that is located in the ~/.kube directory. You can specify other kubeconfig files by setting the $KUBECONFIG environment variable, as done in the step above.
  5. View your cluster’s nodes using kubectl.

     kubectl get nodes
    
    Note
    If your kubectl commands are not returning the resources and information you expect, then your client may be assigned to the wrong cluster context. Visit our Troubleshooting Kubernetes guide to learn how to switch cluster contexts.

    You are now ready to manage your cluster using kubectl. For more information about using kubectl, see Kubernetes’ Overview of kubectl guide.

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.