Bootstrap FreeKB - OpenShift - Creating a Must Gather using the oc adm must-gather command
OpenShift - Creating a Must Gather using the oc adm must-gather command

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc adm must-gather command can be used to create a directory in your present working directory named must-gather.local.xxxxxxxxxxxxx that can be provided to Red Hat Support when debugging some issue. 

oc adm must-gather

 

Be aware that the must-gather directory that gets created can be very large. For example, my /tmp directory ran out of space when the must-gather directory reached 4.7 GB. So, you'll need to create the must gather in a directory that has plenty of available space.

~]$ du -hs /tmp/*
4.7G    must-gather.local.192206360721724425

 

You will almost always want to use the tar command to create a gzip compressed tar archive of the must-gather directory.

tar -zcpf must-gather.local.192206360721724425.tar.gz must-gather.local.192206360721724425/

 

The oc adm must-gather command with no additional options can run for a very long time (hours) and create a very large directory containing GB of files. For this reason, when possible, it is much better to run the oc adm must-gather command with the --image option followed by an image, when debugging an issue with a specific image.

oc adm must-gather --image=registry.redhat.io/container-native-virtualization/cnv-must-gather-rhel8:v4.9.0

 

Or like this.

oc adm must-gather --image=$(oc get deployment.apps/cluster-logging-operator --namespace openshift-logging --output jsonpath='{.spec.template.spec.containers[?(@.name == "cluster-logging-operator")].image}')

 

The following can be used to just get the must gather of the audit logs.

oc adm must-gather -- /usr/bin/gather_audit_logs

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 9ef5f9 in the box below so that we can be sure you are a human.