Skip to content

Ramilito/kubectl.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubectl.nvim

Processes kubectl outputs to enable vim-like navigation in a buffer for your cluster.

✨ Features

  • Navigate your cluster in a buffer, using hierarchy where possible (backspace for up, enter for down) e.g. root -> deplyoment -> pod -> container
  • Colored output and smart highlighting
  • Floating windows for contextual stuff such as logs, description, containers..
Run custom commands e.g `:Kubectl get configmaps -A`
Change context using cmd`:Kubectx context-name`
Exec into containers
Sort by headers
Tail logs

⚡️ Dependencies

  • kubectl
  • neovim >= 0.10

📦 Installation

Install the plugin with your preferred package manager:

return {
  {
    "ramilito/kubectl.nvim",
    keys = {
      {
        "<leader>k",
        function()
          require("kubectl").open()
        end,
        desc = "Kubectl",
      },
    },
    config = function()
      require("kubectl").setup()
    end,
  },
}

⚙️ Configuration

Setup

{
  auto_refresh = {
    enabled = false,
    interval = 3000, -- milliseconds
  },
  namespace = "All",
  notifications = {
    enabled = true,
    verbose = false,
    blend = 100,
  },
  hints = true,
  context = true,
  float_size = {
    -- Almost fullscreen:
    -- width = 1.0,
    -- height = 0.95, -- Setting it to 1 will cause bottom to be cutoff by statuscolumn

    -- For more context aware size:
    width = 0.9,
    height = 0.8,

    -- Might need to tweak these to get it centered when float is smaller
    col = 10,
    row = 5,
  },
  obj_fresh = 0, -- highlight if creation newer than number (in minutes)
  mappings = {
    exit = "<leader>k",
  }
}

Performance

Startup

No startup impact since we load on demand.

Usage

Sorting

By moving the cursor to a header word and pressing s

Exec into container

In the pod view, select a pod by pressing <cr> and then again <cr> on the container you want to exec into

Versioning

Warning

As we have not yet reached v1.0.0, we may have some breaking changes in cases where it is deemed necessary.

Motivation

This plugins main purpose is to browse the kubernetes state using vim like navigation and keys, similar to oil.nvim for filebrowsing. I might add a way to act on the cluster (delete resources, edit) in the future, not sure yet.