sponsor Vim development Vim logo Vim Book Ad

Vimkubectl : Manage any Kubernetes resource from Vim

 script karma  Rating 14/5, Downloaded by 349  Comments, bugs, improvements  Vim wiki

created by
Saud Mohammed
script type
Source: https://github.com/rottencandy/vimkubectl
Maintainer: md.saud020 (at) gmail (dot) com

Make sure your Kubernetes cluster is reachable and configured using kubectl or a similar command.(see configuration)

:Kget {resource}
- Get a list of all objects of type {resource}. If {resource} is not given, pod is used.
You can also use <Tab> for completion and to cycle through possible resources.
    - gr to refresh/update the list of resources.
    - ii (think, "insert mode") to open and edit the manifest of the resource under cursor, in the current window(opens in YAML format)
    - is to open in a split.
    - iv to open in a vertical split.
    - it to open in a new tab.
    - dd to delete the resource under cursor. (Prompts for confirmation)

:Kedit {resource} {object}
- Open a split containing the manifest of {object} of type {resource}. Also has <Tab> completion.

The opened manifest can be edited just like a regular file, except that it gets applied on every save. The following mappings are available in these buffers:
    - gr to refresh/update the manifest. Note that this will disregard any unsaved local changes.

    - :Ksave {filename}
    to save the manifest locally. If {filename} is not given, the resource object name is used.

    - :Knamespace {name}
    to change the currently selected namespace to {name}. If {name} is not given, prints the currently used namespace.
    <Tab> completion can be used to cycle through available namespaces.

    - :{range}Kapply
    Apply file contents. When used with a selection({range}), applies the selected content, else applies the entire file.
    Can be used on any open buffer.


If your kubectl command is under a different name, or you are using an alternate command, it can be specified with g:vimkubectl_command.

For example to specify OpenShift's oc as the command, add this to your vimrc:
    let g:vimkubectl_command = 'oc'

The maximum wait time, or the amount of time to wait for the cluster to return, can be specified with g:vimkubectl_timeout. The default timeout limit is 5 seconds.
For example, to change the wait time to 10 seconds:
    let g:vimkubectl_timeout = 10

Please consider voting if you like this.
install details
Use your favourite plugin manager.

Or use Vim8's built-in package support:

git clone github.com/rottencandy/vimkubectl.git ~/.vim/pack/plugins/start/vimkubectl

Help tag files can be generated inside Vim using :helptags ALL.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vimkubectl-0.11.0.tar.gz 0.11.0 2021-04-07 8.1 Saud Mohammed - Change buffer names from __kubernetes__/* to kube://*, this will enable better overriding of buffers.
- Use BufReadCmd to manage buffers, there can now be multiple resource & list view buffers
- Display resource count in list view
- Use vint to identify bugs and reduce bad patterns
- Multiple minor bug fixes
vimkubectl-0.9.6.tar.gz 0.9.6 2020-08-08 8.0 Saud Mohammed Added {range} support for :Kapply.
vimkubectl-0.9.5.tar.gz 0.9.5 2020-07-28 8.0 Saud Mohammed Added Kapply command and streamline other commands.
vimkubectl-0.9.0.tar.gz 0.9.0 2020-03-12 8.0 Saud Mohammed New Commands:

- KEdit {resource} {object}
Open a split containing the manifest of {object} of type {resource}. Also has <Tab> completion.
vimkubectl-0.8.tar.gz 0.8.0 2020-03-01 8.0 Saud Mohammed Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.