For the lazy, you can install my full config lazyvim with kube-utils-nvim installed [template]
This Neovim plugin provides seamless integration with Kubernetes and Helm, allowing you to deploy and manage Kubernetes resources directly from your editor.
- Kubernetes Context and Namespace Management: Easily switch between different Kubernetes contexts and namespaces.
- CRD Viewer: View Custom Resource Definitions directly in Neovim.
- Helm Integration: Manage Helm charts, update dependencies, and deploy directly from Neovim.
- Log Viewer and Formatting: Transform Kubernetes log files into a more readable JSON format.
- Telescope Integration: Utilize Telescope for picking Kubernetes contexts, namespaces, and viewing Helm releases.
- LSP Integration: Toggle YAML and Helm LSP settings based on the context within Neovim.
- K9s Integration: Open k9s from nvim
Here are some visual previews of the plugin in action
Telescope NS selector :
Install the plugin using your preferred Neovim package manager. Example for lazy.nvim
:
-- ~/.config/nvim/lua/plugins/kube-utils.lua
return {
{
"h4ckm1n-dev/kube-utils-nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
lazy = true,
event = "VeryLazy"
},
}
Use the following mappings to access Kubernetes features efficiently:
local kube_utils_mappings = {
{ "<leader>k", group = "Kubernetes" }, -- Main title for all Kubernetes related commands
-- Helm Commands
{ "<leader>kh", group = "Helm" },
{ "<leader>khT", "<cmd>HelmDryRun<CR>", desc = "Helm DryRun Buffer" },
{ "<leader>khb", "<cmd>HelmDependencyBuildFromBuffer<CR>", desc = "Helm Dependency Build" },
{ "<leader>khd", "<cmd>HelmDeployFromBuffer<CR>", desc = "Helm Deploy Buffer to Context" },
{ "<leader>khr", "<cmd>RemoveDeployment<CR>", desc = "Helm Remove Deployment From Buffer" },
{ "<leader>kht", "<cmd>HelmTemplateFromBuffer<CR>", desc = "Helm Template From Buffer" },
{ "<leader>khu", "<cmd>HelmDependencyUpdateFromBuffer<CR>", desc = "Helm Dependency Update" },
-- Kubectl Commands
{ "<leader>kk", group = "Kubectl" },
{ "<leader>kkC", "<cmd>SelectSplitCRD<CR>", desc = "Download CRD Split" },
{ "<leader>kkD", "<cmd>DeleteNamespace<CR>", desc = "Kubectl Delete Namespace" },
{ "<leader>kkK", "<cmd>OpenK9s<CR>", desc = "Open K9s" },
{ "<leader>kka", "<cmd>KubectlApplyFromBuffer<CR>", desc = "Kubectl Apply From Buffer" },
{ "<leader>kkc", "<cmd>SelectCRD<CR>", desc = "Download CRD" },
{ "<leader>kkk", "<cmd>OpenK9sSplit<CR>", desc = "Split View K9s" },
{ "<leader>kkl", "<cmd>ToggleYamlHelm<CR>", desc = "Toggle YAML/Helm" },
-- Logs Commands
{ "<leader>kl", group = "Logs" },
{ "<leader>klf", "<cmd>JsonFormatLogs<CR>", desc = "Format JSON" },
{ "<leader>klv", "<cmd>ViewPodLogs<CR>", desc = "View Pod Logs" },
-- Register the Kube Utils keybindings
require('which-key').add(kube_utils_mappings)
- Neovim 0.9.0 or higher
- Helm
- kubectl
- k9s
No additional configuration is required. Simply install the plugin and start using the commands.
This plugin is licensed under the MIT License. See the LICENSE file for details., also feel free to submit a PR
h4ckm1n π» |
ohdearaugustin π» |
This project follows the all-contributors specification. Contributions of any kind welcome!