Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 2.36 KB

README.md

File metadata and controls

56 lines (40 loc) · 2.36 KB

k8s.nvim

Neovim Lua K8s

Neovim plugin that wraps some of the kubectl operations

Prerequisites

  1. You need to have Telescope installed
  2. You need kubectl in your system path
  3. The environment variable KUBECONFIG should be set. Containing the path to your kube config file
export KUBECONFIG=/path/to/config/file

Installation

Use you favorite plugin manager. If you use vim-plug, add this to your init.vim / init.lua

Plug 'arjunmahishi/k8s.nvim'

Configuration

require('k8s').setup {
  kube_config_dir = '/tmp/kubeconfig' -- (optional) Set the directory where the kube config files are present
}

Commands

These are the commands that are available for now. More will be added in the coming weeks

Command Description
:K8sNamespaces List all the namespaces in the current cluster

Telescope actions
enter - list all the pods of the namespace
ctrl + c - list config maps of the namespace
:K8sKubeConfig List all the kube config paths in the configured directory

Telescope actions
enter - set the selected config path as the KUBECONFIG
:K8sConfigMaps <namespace> List all the config maps in the given namespace

Telescope actions
enter - copy the config into a new buffer
:K8sPods <namespace> List all the pods in the given namespace

Telescope actions
enter - copy the pod description into a new buffer

Useful key bindings

vim.api.nvim_set_keymap('n', '<leader>kc', ':K8sKubeConfig<CR>', {})
vim.api.nvim_set_keymap('n', '<leader>kn', ':K8sNamespaces<CR>', {})

If you have any questions about how to use the plugin or need help understanding the code, feel free to create a new discussion / slide into my DM