Skip to main content

"AGENT" K is a complete minimalistic kubectl "doner"-wrap

Project description

"k"

TLDR;

Install the "k" by either doing:

pip install agentk

(Yes, ^^ it is written in python and your OS needs to have recent version 2 or 3)

or copying it in some bin folder on your PATH and running pip install -r requirements.txt


"A person is smart. People are dumb, panicky, dangerous animals, and you know it." -- Agent K

"AGENT" K is a complete minimalistic kubectl "doner"-wrap

Obviously, as a short-hand wrapper, k can do everything kubectl already can, but it is (a) shorter and (b) adds few tricks like merging configs and switching contexts .. (k) feeds back to the kubectl command-line those args which it does not want to intercept or handle.

Usage

The following is equivalent:

kubectl get pods --all-namespaces
k get pods -A
k p -A

Switching context

Argument-free invocation prompts for context switch options between multiple cluster contexts found in ~/.kube/config:

k

Switching namespaces

One can change the default namespace on the currently active context (namespace key in ~/.kube/config) using either of two equivalent commands:

kubectl config set-context $(kubectl config current-context) --namespace foo
k sn foo

The last command is a k shortcut.

Shortcuts to get resources

You can find the full list of shortcuts defined as the dictionary inside the k script. In particular that would be:

# resource
"ev": "event",
"ep": "endpoints",
"p": "pod",
"s": "service",
"v": "volume",
"n": "node",
"dp": "deployment",
"st": "statefulset",
"in": "ingress",
"ns": "namespace",

At the end of the list there are one letter action-shortcuts:

# actions
"c": "create",
"a": "apply",
"d": "delete",

This means that the following is equivalent:

kubectl apply -f <foo-k8s-manifest.yaml>
k a -f <foo-k8s-manifest.yaml>

Develop

To remind, you can do pip install -e . in order to utilize developer mode.

Installation in the cloud

If you work with kubectl without a privileged or super-user access, for example inside a corporate network or in a cloud-shell (but you still have access to python), then your installation will look like:

pip install --user agentk

This will install the script in your local $HOME folder.

Don't forget to append your ~/.bashrc or ~/bash_profile or other shell-rc file with:

export PATH="$HOME/.local/bin:$PATH"

Command completion

You can put this into your .bashrc to get alias and auto completion for k similar as for kubectl:

source <(kubectl completion bash | sed s/kubectl/k/g)

Similar works well for zsh.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentk-0.3.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

agentk-0.3.1-py3.6.egg (5.5 kB view details)

Uploaded Source

File details

Details for the file agentk-0.3.1.tar.gz.

File metadata

  • Download URL: agentk-0.3.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.5

File hashes

Hashes for agentk-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d1c08fabc2cc8669c9c861e23be923486b2c707fcf5b54df6a753c130617fd68
MD5 d9debefd7f320c993e015fc383e95a6b
BLAKE2b-256 7b9e0e990c03bccddb33de16ddfb5edb443f467af227369fe901c92f74da304a

See more details on using hashes here.

File details

Details for the file agentk-0.3.1-py3.6.egg.

File metadata

  • Download URL: agentk-0.3.1-py3.6.egg
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.5

File hashes

Hashes for agentk-0.3.1-py3.6.egg
Algorithm Hash digest
SHA256 7661be8cf340249bc15d4ee755037a25ba0a4d31d25ef4797e43d9437cdd9a74
MD5 a14e24d12e32b7c9843ffd38533eaa20
BLAKE2b-256 d8ccdbbb10c42ec766ea2b9d4f572f240dbf9d8b0a524b2e69bd819b4fe9dcff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page