kubernetes-must-gather
is a custom must-gather image and collection script for Kubernetes and OpenShift. It should work on AMD/x64, ARM/AARCH, PPC64, and z/Linux. The image is published to Red Hat's Quay.io at quay.io/ibm/kubernetes-must-gather. The image is based on the oc adm must-gather
image.
oc adm must-gather --image=quay.io/ibm/kubernetes-must-gather:0.1.20250702006
kubernetes-must-gather
gathers significantly less than the default oc adm must-gather
image because kubernetes-must-gather
is designed for a more lightweight and iterative workflow using command line flags. By default, kubernetes-must-gather
gathers:
oc describe
YAMLs for all namespaces for the following resources:nodes pods events securitycontextconstraints
- Pod logs of pods in CrashLoopBackOff state for all namespaces. Disable with
--no-logs-crashloopbackoff
oc adm must-gather --image=quay.io/ibm/kubernetes-must-gather:0.1.20250702006 -- gather -h
kubernetes-must-gather
can run any of the other collection scripts available in the upstream oc adm must-gather
collection-scripts. Just pass --
and the name of the script (multiple allowed and they're executed in sequence). For example, to run gather_apirequestcounts
:
oc adm must-gather --image=quay.io/ibm/kubernetes-must-gather:latest -- gather --gather_apirequestcounts
This calls https://github.com/openshift/must-gather/blob/main/collection-scripts/gather_apirequestcounts and extra output is in the download at must-gather.local.*/quay-io-ibm-kubernetes-must-gather*/requests/
We generally recommend using a specific tag rather than latest
because oc adm must-gather
uses an ImagePullPolicy
of PullIfNotPresent
so if you were to use --image=quay.io/ibm/kubernetes-must-gather:latest
once, then you could not get a newer version of the latest
image in the same cluster unless you manually deleted that image from the internal image registry.
- Build the image for your cluster platform; for example:
podman build --platform linux/amd64 -t kubernetes-must-gather .
- Get your cluster registry URL:
REGISTRY=$(oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}')
- Find the local image ID:
IMAGE_ID=$(podman images | grep "localhost/kubernetes-must-gather" | awk '{print $3}')
- Set a unique version of the image:
VERSION="..."
- Set the namespace/project to push the image to (make sure this namespace exists):
NAMESPACE="customimages"
- Login to your remote image registry with podman:
podman login ${REGISTRY}
- Tag the local image for the remote image registry:
podman tag ${IMAGE_ID} ${REGISTRY}/${NAMESPACE}/kubernetes-must-gather:${VERSION}
- Push the image to the remote image registry (may require exposing the registry):
podman push ${IMAGE_ID} ${REGISTRY}/${NAMESPACE}/kubernetes-must-gather:${VERSION}
- Use the image. For example:
oc adm must-gather --image=image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/kubernetes-must-gather:${VERSION}
- Update the
VERSION=
line ingather
- Set a variable to this version in your shell:
VERSION="..."
- Create the manifest (error if it exists is okay):
podman manifest create quay.io/ibm/kubernetes-must-gather:latest
- Remove any existing manifest images:
for i in $(podman manifest inspect quay.io/ibm/kubernetes-must-gather:latest | jq '.manifests[].digest' | tr '\n' ' ' | sed 's/"//g'); do podman manifest remove quay.io/ibm/kubernetes-must-gather:latest $i; done
- Build the images:
podman build --platform linux/amd64,linux/ppc64le,linux/s390x,linux/arm64 --jobs=1 --manifest quay.io/ibm/kubernetes-must-gather:latest .
- Log into Quay:
podman login quay.io
- Push with the version in step 1:
podman manifest push --all quay.io/ibm/kubernetes-must-gather:latest docker://quay.io/ibm/kubernetes-must-gather:$VERSION
- Test the tag:
- Make sure it basically works with usage:
oc adm must-gather --image=quay.io/ibm/kubernetes-must-gather:$VERSION -- gather -h
- Run the default must gather:
oc adm must-gather --image=quay.io/ibm/kubernetes-must-gather:$VERSION
- Make sure it basically works with usage:
- If testing looks good, push to the
latest
tag:podman manifest push --all quay.io/ibm/kubernetes-must-gather:latest docker://quay.io/ibm/kubernetes-must-gather:latest
- Test the
latest
tag:oc adm must-gather --image=quay.io/ibm/kubernetes-must-gather:latest
- If all looks good, update the version above in the README.
If you have any questions or issues you can create a new issue here.
Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make. For example:
- Fork the repo
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
All source files must include a Copyright and License header. The SPDX license header is preferred because it can be easily scanned.
If you would like to see the detailed LICENSE click here.
#
# Copyright IBM Corporation. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
- Author: Kevin Grigorenko - mailto:kevin.grigorenko@us.ibm.com
- Author: Leon Foret - mailto:ljforet@us.ibm.com
- Author: Amar Kalsi - mailto:amarkalsi@uk.ibm.com
- Author: Kaifu Wu - mailto:kfwu@tw.ibm.com