This project containerizes the kubectl command along with useful utilities like kubectx, kubeps1, and kubetail to facilitate managing kubernetes clusters from the command line without having to install these tools.
This is a Depend on Docker project which comes operational out of the box and is configured with reasonable defaults, which can be customized as needed.
The project contains the following scripts:
config.sh - open the configuration file .env in an editor so the project can be customizedbuild.sh - build the container imagetest.sh - run container unit testspush.sh - push the container image to a registrypull.sh - pull the container image from a registryrun.sh [cmd] - run the container, passing an argument overrides the default commandstatus.sh - show container status - running, exited, etc.logs.sh - tail container logsexec.sh [cmd] - open a shell or execute a specified command in the running containerTo start the container, execute:
docker run -it --rm -v ${HOME}/.kube:/etc/.kube iankoulski/do-kubectl bash
or clone the repo and execute
./run.sh bash
or
./run.sh
./exec.sh
As soon as the bash shell opens in the container, you can check the available aliases by running alias::
k - kubectl
kctl - kubectl
kn - kubens
kc - kubectx
kt - kubetail
koff - turn off kubernetes info from prompt
kon - turn on kubernetes info in prompt
You can execute commands against the kubernetes contexts configured in your ${HOME}/.kube folder.
kubectl get nodes
or
k get no
Content type
Image
Digest
Size
149.3 MB
Last updated
over 5 years ago
docker pull iankoulski/do-kubectl