|
|
|
|
|
by physicles
1809 days ago
|
|
direnv is our magic sauce for this.
We enforce that all devs store the current context in an environment variable (KUBECTL_CONTEXT), and define the appropriate kubectl alias to always use that variable as the current context. To do stuff in a cluster, cd into that cluster’s directory, and direnv will automatically set the correct context. I also change prompt colors based on the current context. (This way, the worst you can do is re-apply some yaml that should’ve already been applied in that cluster anyway) We also have a Makefile in every directory, where the default pseudo-target is the thing you want 99% of the time anyway: kustomize build | kubectl apply -f - |
|