How to edit the Kubernetes configurations confidently using the Zed Editor

The Zed Editor has been my daily driver for writting code for over a year now. It has become an integral part of my workflow, and I have also contributed to it by creating and maintaining the Erlang plugin. While I’m very happy with the experience, I found myself having to often go back to Visual Studio Code to edit Kubernetes configurations that I work with on my day to day.

I started to look for some solutions to this problem, and I found that the Zed Editor uses the yaml-language-server to edit YAML files and this language server has support for providing Kubernetes schema validation. This means that the Zed Editor can provide real-time validation and error checking for Kubernetes configurations, making it easier to catch and fix errors without having to switch to another editor or running kubectl commands which can be time-consuming.

To enable this, you need to edit your ~/.config/zed/settings.json (Accessed with CMD + , in OSX) file and add the following lines:

"lsp": {
    "yaml-language-server": {
      "settings": {
        "yaml": {
          "schemaStore": {
            "enable": true
          },
          "completion": true,
          "schemas": {
            "kubernetes": "**.yaml"
          }
         ...
        }
      }
    }
  }

Now you get autocompletion, schema validation and documentation for Kubernetes configurations:

Kubernetes configurations autocompletion

Kubernetes configurations documentation

This small addition has made a significant difference in my workflow, and I highly recommend it to anyone who works with Kubernetes configurations.

Enjoy!