3 ms·
Check out direnv, and use a shell alias for kubectl. And yeah, current context is evil.
by physicles 2y ago
Check out direnv, and use a shell alias for kubectl. And yeah, current context is evil.
- 8organicbits 2y agoThis is a good suggestion, but keep in mind that you can accidentally run a command in the wrong directory. I've certainly done that too, with painful results.
- physicles 2y agoWhat kind of command was it? If I’m doing something more involved, I’ve got a k9s window open in another pane, making sure the command is having the intended effect. I guess the riskiest commands would be things like deleting persistent volumes. But our storage class doesn’t automatically clean up the disk in the cloud provider, so we could recover from that too.
- remram 2y agoWhat if you have dev and prod clusters/namespaces for the same project (and thus directory)?
- physicles 2y agoWe’ve avoided that situation with kustomize. Common resources go into a ‘bases’ directory, and if two clusters have identical resources, then they both have their own directories and reference all the base resources from there. In practice, there are always slight differences between cluster config between test and prod (using different S3 buckets, for example) so this is needed anyway.