Sahas
Sahas

Reputation: 3186

kubectl current-context - is it possible to keep more than one current-context active?

kubectl switches the context the moment we create a new cluster. since I'm trying to mimic a client server architecture, I need to view rolling logs (kubectl logs pod-id) from both sides (server cluster and agents cluster). Right now, I'm switching context using kubectl config use-context between them, is that right method? is there a way to keep more than one context active at the same time?

Upvotes: 5

Views: 2744

Answers (1)

Robert Bailey
Robert Bailey

Reputation: 18210

You can only have one active context at a time. But kubectl accepts a --context argument (see https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#define-clusters-users-and-contexts) with every command so that you can explicitly pass in the context for each command.

Upvotes: 6

Related Questions