kubectl is the official command-line tool for Kubernetes. It allows you to run commands against Kubernetes clusters to deploy applications, inspect and manage cluster resources, and view logs.
This kubectl distribution is an image provided by the Sourcemation packaging team.
To run temporary container with the image and print kubectl help:
docker run --rm -it sourcemation/kubectl:latest
You can also run kubectl commands directly, for example:
docker run --rm -it sourcemation/kubectl:latest version --client
You can also mount your kubeconfig file to the container to interact with your Kubernetes cluster. For example:
docker run --rm -it -v $HOME/.kube:/home/kubectl/.kube sourcemation/kubectl:latest get pods
Or more interactively by changing the entrypoint to bash:
docker run --rm -it --entrypoint bash -v $HOME/.kube:/home/kubectl/.kube sourcemation/kubectl:latest
This will open a shell inside the container, where you can then run your kubectl commands as needed, for example:
kubectl get nodes
All above commands can be run with podman as well :).
kubectl commandYou can create an alias in your shell to simplify the usage of the sourcemation/kubectl
image. Add the following line to your shell configuration file (e.g., .bashrc, .zshrc):
alias kubectl='docker run --rm -it -v $HOME/.kube:/home/kubectl/.kube sourcemation/kubectl:latest'
and then reload your shell configuration (just start a new shell or source the file). Use it carefully and only if you are comfortable with:
kubectl commandskubectl installation that will be shadowed by the aliasThis image uses the following environment variables:
KUBECTL_VERSION=v1.34.0
There is single volume /home/kubectl/.kube to potentially persist kubectl
config.
We'd love for you to contribute! You can request new features, report bugs, or submit a pull request with your contribution to this image on the Sourcemation GitHub repository.
Cloud Native Computing Foundation (CNCF). The respective companies and organisations
own the trademarks mentioned in the offering. The sourcemation/kubectl image
is a separate project and is maintained by
Sourcemation.
The application runs as the kubectl user with a UID of 1001 and a GID of 1001.
You force usage of the root user with the docker --user root flag.
A detailed risk analysis report of the image and its components can be found on the Sourcemation platform.
For more information, check out the Official Kubectl Documentation.
The base license for the kubectl is the Apache License Version 2.0.
Content type
Image
Digest
sha256:84946ad37…
Size
88 MB
Last updated
5 days ago
docker pull sourcemation/kubectl