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.
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¶
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
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
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.
Another useful trait of kubectx is renaming current cluster context to something more meaningful.
Created: November 29, 2023