A collection of plugins for kubectl integration (for Kubectl versions >= 1.12.0)
A portion of these plugins are available on krew as well.
kubectl versionbrew upgrade kubectl, or via gcloud: gcloud components updategit clone https://github.com/jordanwilson230/kubectl-plugins.git
cd kubectl-plugins
./install-plugins.sh
source ~/.bash_profile
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

-n namespace option to specify the namespaceUsage:
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 switchkubectl switch preprodkubectl switch cluster staging (accepts fuzzy on the cluster name)kubeclt switch cluster -l| 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 |

create, scale, delete, apply, etc.,kubectl prompt add -n productionkubectl prompt add -c my-clusterkubectl prompt listkubectl prompt removekubectl prompt
kubectl image -c to set it as the default for future searches.-c, searches will use Docker Hub by default.-p will search Docker Hub, regardless of any default.Example:
kubectl image kafka

Example: kubectl ip cassandra

Example: kubectl uptime