Processes kubectl outputs to enable vim-like navigation in a buffer for your cluster.
:Kubectl get configmaps -A
:Kubectx context-name
<cr>
and then again <cr>
on the container you want to exec into
s
:Kubectl diff (path)
Install the plugin with your preferred package manager:
return {
{
"ramilito/kubectl.nvim",
config = function()
require("kubectl").setup()
end,
},
}
We expose open, close and toggle to bind against:
vim.keymap.set("n", "<leader>k", '<cmd>lua require("kubectl").toggle()<cr>', { noremap = true, silent = true })
{
auto_refresh = {
enabled = true,
interval = 3000, -- milliseconds
},
diff = {
bin = "kubediff" -- or any other binary
},
namespace = "All",
namespace_fallback = {}, -- If you have limited access you can list all the namespaces here
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)
}
The setup function only adds ~1ms to startup. We use kubectl proxy and curl to reduce latency.
[!WARNING] As we have not yet reached v1.0.0, we may have some breaking changes in cases where it is deemed necessary.
This plugins main purpose is to browse the kubernetes state using vim like navigation and keys, similar to oil.nvim for file browsing.