A tool to automate editing Kubernetes config files (merge, rename users and contexts, etc)

Pretty often I need to edit Kubernetes config files (admin.conf from different clusters) to do some simple operations manually:

  • Merge two or more config files into one with renaming the clusters’ names to make them unique.
  • Rename a user, or a context (they should be renamed in several places at once).
  • Change server endpoints.
  • etc.

It is not very hard to make these changes manually in any simple text editor, but it’s too boring and can cause errors.

So, it would be great to have a tool, that will simplify these easy routine tasks, providing some convenient UI and validation.

Does anyone know some tools for automating editing Kubernetes config files?

I guess you are looking for some kind of templating.

In web development, there are million ways to create html.

In Kubernetes there are million ways to create yaml.

Helm is popular

Some like CUE

There is kustomize

I never used jsonnet, and I think I never will.

Too many options.

@Thomas-Guettler No, the question is not about templating at all. I’m talking specifically about the single file - Kubernetes config aka admin.conf with multiple contexts, and simple common operations with it.

So, some kind of UI to edit it will be a great improvement over manual editing of such files.

Posted a feature request to implement this in Lens: Provide an editor for Kubernetes config files with UI to automate merging, renaming and other routine operations · Issue #7990 · lensapp/lens · GitHub