tilt icon indicating copy to clipboard operation
tilt copied to clipboard

set kubernetes context from tiltfile

Open nicks opened this issue 3 years ago • 3 comments

Describe the Feature You Want

Your tiltfile should be able to specify which kubernetes context to switch to.

e.g.,

k8s_context('minikube')

If you edit the k8s_context call in the tiltfile during a tilt session, tilt should disconnect from that cluster and re-connect to the new one.

Why Do You Want This?

This would be a genuinely useful feature on its own! But we also expect this to be a prerequisite for a number of other cluster-management features, like

  • onboarding flows that help you setup a cluster
  • diagnosing a broken cluster
  • resetting a cluster

Additional context

Here are some related issues that get at the same thing: https://github.com/tilt-dev/tilt/issues/1113 (Set the default namespace you're deploying to) https://github.com/tilt-dev/tilt/issues/2123 (reload the kubeconfig when the context changes) https://github.com/tilt-dev/tilt/issues/3791 (set up the kubeconfig during tiltfile initialization) https://github.com/tilt-dev/tilt/issues/3066 (don't connect to kubernetes until you need it)

nicks avatar Dec 09 '21 17:12 nicks

Up for this. That might help to have multiple tilt instances running at once (on top of TILT_PORT env var). Some flexibility here would be greatly appreciated.

nzagorsky avatar Jan 18 '22 17:01 nzagorsky

We should have the possibility to pass the config yaml file as we can do with kubectl with this parameter --kubeconfig='': Path to the kubeconfig file to use for CLI requests.

cmoulliard avatar Feb 25 '22 16:02 cmoulliard

@cmoulliard if you set the KUBECONFIG env variable, I believe tilt will respect that

nicks avatar Feb 25 '22 18:02 nicks