Skip to content

Getting access to clusters

Naisdevice

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

Follow the installation guide to get started

gcloud

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

kubectl

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

brew install asdf
asdf plugin add kubectl
asdf install kubectl 1.22.10
asdf global kubectl 1.22.10

Info

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

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

Convenience

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 22, 2022
Created: November 22, 2022