Kubernetes Deep Dive

Sign Up Free or Log In to participate!

What is a kubernetes context?

I didn’t understand exactly what is a context in the kubernetes cluster. What are they used for?

raoconnor

If you are connecting to multiple clusters it’s how you switch between them, for example I use powershell to connect to a google k8 cluster and also have docker for desktop, If I right click the docker for desktop icon I can see the contexts and switch between clusters. I suppose you could say the context is the combination of user and environment I am currently working in.

1 Answers

OK. So technically speaking a context isn’t part of the cluster. As raoconnor suggests, it’s a kubectl client setting that tells kubectl which cluster to send commands to. For example, you might have a test/dev cluster and a separate prod cluster. Two clusters would be two contexts. If you have your kubectl context set to dev/test, all kubectl commands will be issued to the dev/test cluster. If you want to start working on the prod cluster, you switch contexts and kubectl will start sending commands to the prod cluster. HTH. Nigel

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?