Last changed
docker pull cgr.dev/chainguard/kubectl
Need access to a specific tag? Contact us.
Be the first to hear about exciting product updates, critical vulnerability alerts, compare alternative images, and more.
Sign UpMinimal image with kubectl binary.
Chainguard Containers are regularly-updated, secure-by-default container images.
For those with access, this container 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:
Chainguard Containers are minimal container images that are secure by default.
In many cases, the Chainguard Containers tagged as :latest
contain only an open-source application and its runtime dependencies. These minimal container images typically do not contain a shell or package manager. Chainguard Containers are built with Wolfi, our Linux undistro designed to produce container images that meet the requirements of a more secure software supply chain.
The main features of Chainguard Containers include:
For cases where you need container images with shells and package managers to build or debug, most Chainguard Containers come paired with a -dev
variant.
Although the -dev
container image variants have similar security features as their more minimal versions, they feature additional software that is typically not necessary in production environments. We recommend using multi-stage builds to leverage the -dev
variants, copying application artifacts into a final minimal container that offers a reduced attack surface that won’t allow package installations or logins.
To better understand how to work with Chainguard Containers, please visit Chainguard Academy and Chainguard Courses.
In addition to Containers, Chainguard offers VMs and Libraries. Contact Chainguard to access additional products.
This software listing is packaged by Chainguard. The trademarks set forth in this offering are owned by their respective companies, and use of them does not imply any affiliation, sponsorship, or endorsement by such companies.
Chainguard container images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" tag 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.