1 min read | by Jordi Prats
Since we can have several clusters configured we need to know to which cluster we are issues commands to, there are several ways we can do it with kubectl config:
With kubectl config current-context we'll get the name of the current context we are using:
$ kubectl config current-context
default/api-demo:6443/cluster-admin
But with kubectl config current-context we'll be able to see all the available contexts and it's details, being the current one marked with a star:
$ kubectl config current-context
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* default/api-demo:6443/cluster-admin api-demo:6443 cluster-admin/api-demo:6443 test-ns
kind-kind kind-kind kind-kind demo-ns
Posted on 03/11/2022