Skip to main content

K8S access setup & KUBECONFIG

Kubectl setup

Install kubectl binary


Kubeconfig Setup

To access a remote cluster, you'll need to use a kubeconfig file.

The kubeconfig file is a YAML file that configures access to a Kubernetes cluster. It stores information such as:

  • Clusters: The Kubernetes API servers you're connecting to.
  • Users/Contexts: The user credentials or token used to authenticate when accessing the cluster.
  • Contexts: A combination of a cluster, a user, and a namespace. Contexts allow you to easily switch between different clusters and namespaces with the same or different user credentials.
  • Current Context: The active context that defines which cluster and namespace you're currently working in.

To set kubeconfig for current session:

export KUBECONFIG=/path/to/your/kubeconfig/file

To set kubeconfig for user persistently, you'll need to modify the bashrc file for your user. Add the following to the bottom of your bashrc file:

export KUBECONFIG=/path/to/your/kubeconfig