Skip to content

Getting access to clusters


Since all NAIS clusters are private, you will need to install naisdevice to access the cluster.

Follow the installation guide to get started


First you need to install gcloud, following the instructions for your platform.


kubectl is a command-line tool used to manage your Kubernetes resources.

brew install asdf
asdf plugin add kubectl
asdf install kubectl 1.26.5
asdf global kubectl 1.26.5


kubectl is supported within one minor version (older or newer) of kube-apiserver. Using brew to manage kubectl will make it troublesome to be within the version skew. We therefor recommend installing kubectl manually, or through tools like asdf.

Cluster credentials

Option 1: Using nais-cli

If you have nais-cli installed, you can use it to get a kubeconfig for all clusters.

nais kubeconfig

It requires that you have logged into gcloud using gcloud auth login --update-adc and is connected with naisdevice.

Option 2: Using gcloud

For each cluster that you want access to, you need to login to gcloud and know the cluster name and project id.

gcloud container clusters get-credentials <cluster name> --project <project id>  --region europe-north1


To ease switching namespaces and clusters, tools like kubectx and kubens can be used.

asdf plugin add kubectx
asdf plugin add kubens
asdf install kubectx latest
asdf install kubens latest
asdf global kubectx latest
asdf global kubens latest

Once installed, you can use kubectx and kubens to switch between clusters and namespaces.

kubectx <cluster name>
kubens <namespace>

Another useful trait of kubectx is renaming current cluster context to something more meaningful.

kubectx <preferred name>=.

Last update: November 29, 2023
Created: November 29, 2023