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:latest
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:latest -- gather -h
- Gather
etcd
pod logs:--logs-etcd
- Disable gathering CrashLoopBackOff pod logs:
--no-logs-crashloopbackoff
- Enable verbose logging:
--log=2
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
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. Consult the tag in the release name of the latest release (e.g. 0.1.20250715013 in the URL) to use a specific version.
- Update the
VERSION=
line ingather
- Set a variable to this version in your shell:
export VERSION="..."
- Set the namespace/project to push the image to (make sure this namespace exists):
export NAMESPACE="customimages"
- 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 }}')
- Login to your remote image registry with podman:
podman login --tls-verify=false -u $(oc whoami | sed 's/://g') -p $(oc whoami -t) ${REGISTRY}
- Push the image to the remote image registry (may require exposing the registry):
podman push --tls-verify=false localhost/kubernetes-must-gather:latest ${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:
export 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 everything looks good
- Add and push a tag:
git tag $VERSION
- Then find this new tag in the tag list, click the ellipses, click Create release, and then create a new release.
- Add and push a tag:
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:[email protected]
- Author: Leon Foret - mailto:[email protected]
- Author: Amar Kalsi - mailto:[email protected]
- Author: Kaifu Wu - mailto:[email protected]