Hacker News new | past | comments | ask | show | jobs | submit login

Have been burnt by this, I have to deal with close to 8 clusters and it is very easy to make a mistake.

Would highly recommend kubie, it allows you to switch and shows you the name of the cluster in the prompt. It's probably a more visual way of solving the same problem.

https://github.com/sbstp/kubie




It also solves a problem many of the other solutions here miss: the prompt is printed once and so it can easily be showing stale information if you change the current context in another shell.

With kubie entering a context copies the configuration to a new file and sets KUBECONFIG appropriately, so it is not affected by changes in another shell.


I do this with kubectx to switch and kube-ps1 with ohmyzsh to display cluster/namespace in my usual prompt


'close to 8 clusters' is a strange turn of phrase. So you manage 6 or 7?


It might also be a trick — maybe it’s nine?


7 during good times. 8 when things go south.


I toyed with the idea of having a kubeconfig per cluster some time ago, but I work with 10s of clusters on a daily basis (often with multiple terminals targeting the same cluster) and having to auth every single time would have been too much of a pain.

Instead I went with kubeswitch which still gives you a different kubeconfig per terminal but allows you to re-use existing sessions.

https://github.com/danielfoehrKn/kubeswitch


Cool project, I didn't know it. I love the idea, thanks for sharing it!


whether a reauth is necessary depends on your k8s setup a lot of the cloud ones only configure kubeconfig to call an external command, which can share auth state between terminals


Sure, but I'm switching between AWS, Azure and vSphere clusters regularly and they all behave differently.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: