h4ckm1n-dev / kube-utils-nvim

πŸš€ Neovim Kubernetes Plugin : This Neovim plugin provides seamless integration with Kubernetes and Helm, allowing you to deploy and manage Kubernetes resources directly from your editor.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Neovim Kubernetes Plugin

For the lazy, you can install my full config lazyvim with kube-utils-nvim installed [template]

All Contributors

This Neovim plugin provides seamless integration with Kubernetes and Helm, allowing you to deploy and manage Kubernetes resources directly from your editor.

Features

  • 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

Screenshots

Here are some visual previews of the plugin in action

Telescope NS selector :

  • Screenshot 1 K9S module:
  • Screenshot 2 K9S in a vertical split view :
  • Screenshot 3 Get CRD function :
  • Screenshot 4 Get Log and FormatJson :
  • image

Capture Video Preview

Installation

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"
  },
}

Key Bindings

Use the following mappings to access Kubernetes features efficiently:

local helm_mappings = {
  k = {
    name = "Kubernetes", -- Main title for all Kubernetes related commands

    -- Helm Commands
    h = {
      name = "+Helm",
      d = { "<cmd>HelmDeployFromBuffer<CR>", "Helm Deploy Buffer to Context" },
      r = { "<cmd>RemoveDeployment<CR>", "Helm Remove Deployment From Buffer" },
      T = { "<cmd>HelmDryRun<CR>", "Helm DryRun Buffer" },
      u = { "<cmd>HelmDependencyUpdateFromBuffer<CR>", "Helm Dependency Update" },
      b = { "<cmd>HelmDependencyBuildFromBuffer<CR>", "Helm Dependency Build" },
      t = { "<cmd>HelmTemplateFromBuffer<CR>", "Helm Template From Buffer" },
    },

    -- Kubectl Commands
    k = {
      name = "+Kubectl",
      a = { "<cmd>KubectlApplyFromBuffer<CR>", "Kubectl Apply From Buffer" },
      D = { "<cmd>DeleteNamespace<CR>", "Kubectl Delete Namespace" },
      K = { "<cmd>OpenK9s<CR>", "Open K9s" },
      k = { "<cmd>OpenK9sSplit<CR>", "Split View K9s" },
      l = { "<cmd>ToggleYamlHelm<CR>", "Toggle YAML/Helm" },
      c = { "<cmd>SelectCRD<CR>", "Download CRD" },
      C = { "<cmd>SelectSplitCRD<CR>", "Download CRD Split" },
    },

    -- Logs Commands
    l = {
      name = "+Logs",
      f = { "<cmd>JsonFormatLogs<CR>", "Format JSON" },
      v = { "<cmd>ViewPodLogs<CR>", "View Pod Logs" },
    },
  },
}

-- Register the Helm keybindings with a specific prefix
require('which-key').register(helm_mappings, { prefix = "<leader>" })

Requirements

  • Neovim 0.9.0 or higher
  • Helm
  • kubectl
  • k9s

Configuration

No additional configuration is required. Simply install the plugin and start using the commands.

License

This plugin is licensed under the MIT License. See the LICENSE file for details., also feel free to submit a PR

Contributors ✨

h4ckm1n
h4ckm1n

πŸ’»
ohdearaugustin
ohdearaugustin

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

About

πŸš€ Neovim Kubernetes Plugin : This Neovim plugin provides seamless integration with Kubernetes and Helm, allowing you to deploy and manage Kubernetes resources directly from your editor.


Languages

Language:Lua 100.0%