jordanwilson230 / kubectl-plugins

A Collection of Plugins for kubectl Integration (exec as any user, context switching, etc).
Apache License 2.0
623 stars 63 forks source link
automated-deployment ci-cd context-switching deployment devops eks exec gke google-cloud kubectl kubectl-plugins kubernetes namespace namespaces plugins pod ssh

kubectl-plugins

CI Status

A collection of plugins for kubectl integration (for Kubectl versions >= 1.12.0)

A portion of these plugins are available on krew as well.

Note

Install on Linux/Mac

git clone https://github.com/jordanwilson230/kubectl-plugins.git
cd kubectl-plugins
./install-plugins.sh
source ~/.bash_profile

To Uninstall

rm -rf ~/.kube/plugins/jordanwilson230
ex '+g/jordanwilson230/d' -cwq ~/.bash_profile

Remove the image plugin:

ex '+g/IMG_REGISTRY=/d' -cwq ~/.bash_profile

Remove the prompt plugin:

ex '+g/function kubectl()/d' -cwq ~/.bash_profile
ex '+g/KUBECTL_\(.*\)_PROMPT/d' -cwq ~/.bash_profile

kubectl ssh

kapssh

Usage: kubectl ssh [OPTIONAL: -n <namespace>] [OPTIONAL: -u <user>] [OPTIONAL: -c <Container Name>] [REQUIRED: <PodName> ] -- [command]

Example: kubectl ssh -n default -u root -c prometheus prometheus-282sd0s2 -- bash

Option Required Description Example
-h N Show usage kubectl ssh -h
-d N Enable debug mode. Print a trace of each commands kubectl ssh -d kafka-0
-n N The namespace scope for this CLI request kubectl ssh -n infra kafka-0
-u N User to exec as. Defaults to root kubectl ssh -u kafka kafka-0
-c N Specify container within pod kubectl ssh -c burrow-metrics kafka-0
-- N Pass an optional command. Defaults to /bin/sh kubectl ssh kafka -- ls /etc/burrow

kubectl switch

switch

Option Required Description Example
-l N List available clusters and prompts for selection. Can only be used when cluster is passed. | kubNctl switch cluster -l
-h N Show usage kubectl switch -h

kubectl prompt

prompt

kubectl image

image

Example: kubectl image kafka

kubectl ip

kap_ip

Example: kubectl ip cassandra

kubectl uptime

kap_uptime

Example: kubectl uptime