Connect to a Kubernetes cluster using kubectl and a service account token
A detailed description of kubectl is on the Kubernetes documentation.
This post is the description of an IBM post.
At first we have to configure kubectl to connect to the api server of our cluster.
kubectl config set-cluster kubernetes --server=https://192.168.1.254:6443 --insecure-skip-tls-verify=true
Then we set the configuration for our context and the credentials.
kubectl config set-context context-name --cluster=cluster-name
kubectl config set-credentials kubernetes-admin --token=<token>
kubectl config set-context context-name --user=kubernetes-admin
kubectl config set-context context-name --namespace=development
kubectl config use-context context-name
In my post about deploying the Kubernetes dashboard you can see an example of how to create a service account and get the token for this user.