Dynamically inject Kubernetes and CRD schemas into yaml-language-server for YAML files in Neovim. Get validation and completion for your Kubernetes manifests and CRDs, automatically.
- 🧠 Auto-detects
apiVersion
andkind
in your YAML buffer - 🔗 Injects the correct schema for both built-in Kubernetes resources and CRDs
- ⚡ Hot reloads schema on buffer changes
- 🧹 Cleans up temporary schema files on exit
- 🛠️ Zero config — just install and go!
{
"rxbn/kube-schema.nvim",
opts = {},
}
No configuration is required by default.
Just call require("kube-schema").setup()
in your plugin manager.
If you want to customize or extend, PRs and issues are welcome!
In order to prevent the "Matches multiple schemas when only one must validate" error, you can use this helper function to configure yamlls
:
yamlls = require("kube-schema").configure_yamlls(),
You can also pass custom settings to yamlls, they will be merged with the default settings:
yamlls = require("kube-schema").configure_yamlls({
settings = {
yaml = {
validate = true,
},
},
})
You can also use the following manual configuration:
settings = {
yaml = {
schemas = {
kubernetes = "",
},
},
},
- On opening a YAML file, the plugin scans for
apiVersion
andkind
. - It matches these against built-in Kubernetes resources and CRDs.
- The correct JSON schema(s) are combined and injected into the
yamlls
LSP client. - As you edit, the schema updates live.
- Temporary schema files are cleaned up on exit.
Open a Kubernetes manifest:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
# ... get completion and validation!
The correct schema is automatically applied for validation and completion.
- Neovim 0.11+
- yaml-language-server (
yamlls
) enabled in your LSP setup
Q: Does this work with custom CRDs? A: Yes! If your CRD is in the datreeio/CRDs-catalog, it will be picked up automatically.
Q: Does it support multiple resources in one file? A: Yes, all detected resources are combined into a single schema.
Q: Does it modify my LSP config?
A: No, it only updates the schema for the current buffer in yamlls
.
PRs and issues are welcome! Feel free to open an issue if you have any questions or suggestions.
Happy Kubernetes YAMLing! 🚢