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"…

Problem Statement

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"

kubectl.ps1

Step 3 – Discover more "qbitcli" Flags for Kubernetes

kubectl.ps1 --help

Flags

–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.

Usage

Short-hand to view all resources
kubectl.ps1
Use with a flag
kubectl.ps1 [flag]
kubectl.ps1 --context [context name]

Find out more about "qbitcli"

  1. qbitcli on GitHub
  2. qbitcli on DockerHub

More useful Kubernetes Resources on QbitUniverse

  1. Kubernetes Building Blocks
  2. Kubernetes Cheat Sheet
Marcin Narloch

Marcin Narloch

Creative and out-of-the-box thinker with strong interests and knowledge in technology and innovation.
Reset Git Branch Commits Previous post Docker with qbitcli
Reset Git Branch Commits Next post Helm with qbitcli

Leave a Reply

Your email address will not be published. Required fields are marked *