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.
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.
Option 1: Using nais-cli¶
If you have
nais-cli installed, you can use it to get a kubeconfig for all clusters.
It requires that you have logged into
gcloud auth login --update-adc.
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
kubens to switch between clusters and namespaces.
Another useful trait of kubectx is renaming current cluster context to something more meaningful.
Created: March 13, 2023