Working with Kubernetes using the kubectl cli commands is extremely productive and fast – provided you know most of the commands by heart. Soon into your Kubernetes journey you’ll memorise some of the most useful commands very quickly and keep using these, for example kubectl get ns or kubectl list –all-namespaces and so on… right?
Quickly after that, you’ll be sitting in front of your screen and thinking – how can I reduce the typing? or I wish I could just type one short-hand command to do xyz operation….
Some of you will use the CMD/Bash history (arrow up/down) to efficiently navigate between most recently used commands – well – until you have so many of these that you get lost "in the history"…
If only I could have short-hand scripts to help reduce typing some of the most repetitive kubectl cli commands.
qbitcli to the rescue…
What is "qbitcli"?
qbitcli is a bundle full of useful scripts, covering the following technologies: Azure, Docker, Kubernetes and Helm Charts.
All resources inside qbitcli are free, public and constantly updated with new code snippets.
How to use "qbitcli" with Kubernetes
Step 1 – Deploy "qbitcli"
Open CMD, navigate to location where you need the qbitcli resources copied and run the command below. Image always has latest tag and it’s the only tag.
docker create --name qbitcli qbituniverse/qbitcli docker cp qbitcli:/qbitcli/. qbitcli/ docker rm -fv qbitcli docker rmi -f qbituniverse/qbitcli:latest
The end result will be a folder structure created as follows:
|- qbitcli |- kubectl.ps1 |- ...
Step 2 – View all Kubernetes resources with "qbitcli"
Step 3 – Discover more "qbitcli" Flags for Kubernetes
|–view||View all Kubernetes resources. Same as typing kubectl.ps1 on its own.|
|–view-wide||View all Kubernetes resources in wide output.|
|–context||Displays current Kubernetes context.|
|–reset||Resets k8s cache by deleting the config file.|
Short-hand to view all resources
Use with a flag
kubectl.ps1 --context [context name]