Last changed
docker pull cgr.dev/chainguard/kubectl
Need access to a specific version? Contact us.
Get notified of upcoming product changes, critical vulnerability notifications and patches and more.
Sign InMinimal image with kubectl binary.
Chainguard Images are regularly-updated, minimal container images with low-to-zero CVEs.
This image is available on cgr.dev
:
Be sure to replace the ORGANIZATION
placeholder with the name used for your organization's private repository within the Chainguard registry.
The kubectl
Chainguard Image provides a low-to-zero CVE environment for kubectl
suitable for integrating into Kubernetes CI or testing workflows.
To load your own global configuration file, you can set the KUBECONFIG
environment variable and mount a configuration file on your host machine to the specified location on the container using a volume.
The command below sets the KUBECONFIG
environment variable to .kube/config
within the nonroot
home folder, initializes a volume at that location, and runs the container with a command that prints the current configuration. Make sure to replace $ORGANIZATION with the name of your organization.
If you would prefer to test this command without using your own configuration file, you can create a default config
file in your current working directory as below:
In this example, we'll add the Kubectl Chainguard Image to a Kubernetes cluster. To follow this example, you'll need to install the following software to your host machine:
Once the kind
utility for creating local Kubernetes clusters is installed and on your path, create a new cluster with the following command:
This will create a cluster with the default name kind
.
Next, we'll need to download a pull token using Chainguard's chainctl
utility. This will allow us to access your organization's Chainguard Images in environments that do not support OIDC, such as a Kubernetes cluster.
Run the following to generate a pull token:
You will need to select your organization name from the menu and confirm the creation of the pull token. This will save your pull token to your Docker configuration, typically at ~/.docker/config.json
.
Now use kubectl on your host machine to load the pull token as a secret. The following assumes your current working directory is your home directory, and depending on your system and configuration you may need to update the path to the config.json
.
Next, we'll run a shell command to create a configuration for the pod for our kubectl
Chainguard Image container. First, set your organization name as an environment variable:
Then run the following command to create the pod configuration file:
The above provides configuration for a pod that will pull the kubectl
Chainguard Image from your organization, then run a container with a command that outputs the current kubectl
version.
Run the following to create the pod using the configuration file:
The pod should now be created. Run the following command to see information on the pod and associated container:
In the configuration file, we provided the /usr/bin/kubectl version
command. The above output shows this command completed. We can view the output of the command:
The kubectl
Chainguard Image has now been loaded into the cluster and used to run a command. To access cluster information from the container, you will need to configure a security context for the pod or container.
Once you're finished testing, you can shut down and delete the example kind
cluster with the following command:
If you have a Zendesk account (typically set up for you by your Customer Success Manager) you can reach out to Chainguard's Customer Success team through our Zendesk portal.
Chainguard Images are a collection of container images designed for security and minimalism.
Many Chainguard Images are distroless; they contain only an open-source application and its runtime dependencies. These images do not even contain a shell or package manager. Chainguard Images are built with Wolfi, our Linux undistro designed to produce container images that meet the requirements of a secure software supply chain.
The main features of Chainguard Images include:
-dev
VariantsAs mentioned previously, Chainguard’s distroless Images have no shell or package manager by default. This is great for security, but sometimes you need these things, especially in builder images. For those cases, most (but not all) Chainguard Images come paired with a -dev
variant which does include a shell and package manager.
Although the -dev
image variants have similar security features as their distroless versions, such as complete SBOMs and signatures, they feature additional software that is typically not necessary in production environments. The general recommendation is to use the -dev
variants only to build the application and then copy all application artifacts into a distroless image, which will result in a final container image that has a minimal attack surface and won’t allow package installations or logins.
That being said, it’s worth noting that -dev
variants of Chainguard Images are completely fine to run in production environments. After all, the -dev
variants are still more secure than many popular container images based on fully-featured operating systems such as Debian and Ubuntu since they carry less software, follow a more frequent patch cadence, and offer attestations for what they include.
To better understand how to work with Chainguard Images, we encourage you to visit Chainguard Academy, our documentation and education platform.
Chainguard Images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" version of this image:
Apache-2.0
LGPL-2.1-or-later
MIT
MPL-2.0
For a complete list of licenses, please refer to this Image's SBOM.
Software license agreementA FIPS validated version of this image is available for FedRAMP compliance. STIG is included with FIPS image.