Debug School

Cover image for Gather Red Hat OpenShift Cluster Data
Suyash Sambhare
Suyash Sambhare

Posted on • Updated on

Gather Red Hat OpenShift Cluster Data

You can gather debugging information about your cluster by using the oc adm must-gather CLI command. This can be provided to Red Hat Support for resolving issues.

Prerequisites

  • Access to the cluster as a user with the cluster-admin role.
  • The OpenShift Container Platform CLI (oc) installed.

Procedure

  • Navigate to the directory where you want to store the must-gather data.
  • If your cluster is in a disconnected environment, you must take additional steps.
  • If your mirror registry has a trusted CA, you must first add the trusted CA to the cluster.
  • For all clusters in disconnected environments, you must import the default must-gather image as an image stream. $ oc import-image is/must-gather -n openshift

Run the oc adm must-gather command:
$ oc adm must-gather

If you are in a disconnected environment, use the --image flag as part of the must-gather and point to the payload image.
Because this command picks a random control plane node by default, the pod might be scheduled to a control plane node that is in the NotReadyand SchedulingDisabledstate.
If this command fails, for example, if you cannot schedule a pod on your cluster, then use the oc adm inspect command to gather information for particular resources.
Create a compressed file from the must-gather directory that was just created in your working directory. For example, on a computer that uses a Linux operating system, run the following command:
$ tar cvaf must-gather.tar.gz must-gather.local.5987654343232123129/
Make sure to replace must-gather-local.5987654343232123129/ with the actual directory name.

Attach the compressed file to your support case on the Customer Support page of the Red Hat Customer Portal.

To gather specific data from your cluster you can follow the following steps.

  • Navigate to the directory where you want to store the must-gather data.
  • Run the oc adm must-gather command with one or more --image or --image-stream arguments.
  • To collect the default must-gather data in addition to specific feature data, add the --image-stream=openshift/must-gather argument.

The following command gathers both the default cluster data and information specific to OpenShift Virtualization:
$ oc adm must-gather --image-stream=openshift/must-gather --image=registry.redhat.io/container-native-virtualization/cnv-must-gather-rhel8:v4.12.8
You can use the must-gather tool with additional arguments to gather data that is specifically related to OpenShift Logging and the Red Hat OpenShift Logging Operator in your cluster.

must-gather

For OpenShift Logging, run the following command:
$ oc adm must-gather --image=$(oc -n openshift-logging get deployment.apps/cluster-logging-operator -o jsonpath='{.spec.template.spec.containers[?(@.name == "cluster-logging-operator")].image}')

Example must-gather output for OpenShift Logging

├── cluster-logging
  ├── clo
    ├── cluster-logging-operator-74dd5994f-6ttgt
    ├── clusterlogforwarder_cr
    ├── cr
    ├── csv
    ├── deployment
    └── logforwarding_cr
  ├── collector
    ├── fluentd-2tr64
  ├── eo
    ├── csv
    ├── deployment
    └── elasticsearch-operator-7dc7d97b9d-jb4r4
  ├── es
    ├── cluster-elasticsearch
      ├── aliases
      ├── health
      ├── indices
      ├── latest_documents.json
      ├── nodes
      ├── nodes_stats.json
      └── thread_pool
    ├── cr
    ├── elasticsearch-cdm-lp8l38m0-1-794d6dd989-4jxms
    └── logs
       ├── elasticsearch-cdm-lp8l38m0-1-794d6dd989-4jxms
  ├── install
    ├── co_logs
    ├── install_plan
    ├── olmo_logs
    └── subscription
  └── kibana
     ├── cr
     ├── kibana-9d69668d4-2rkvz
├── cluster-scoped-resources
  └── core
     ├── nodes
       ├── ip-10-0-146-180.eu-west-1.compute.internal.yaml
     └── persistentvolumes
        ├── pvc-0a8d65d9-54aa-4c44-9ecc-33d9381e41c1.yaml
├── event-filter.html
├── gather-debug.log
└── namespaces
   ├── openshift-logging
     ├── apps
       ├── daemonsets.yaml
       ├── deployments.yaml
       ├── replicasets.yaml
       └── statefulsets.yaml
     ├── batch
       ├── cronjobs.yaml
       └── jobs.yaml
     ├── core
       ├── configmaps.yaml
       ├── endpoints.yaml
       ├── events
         ├── elasticsearch-im-app-1596020400-gm6nl.1626341a296c16a1.yaml
         ├── elasticsearch-im-audit-1596020400-9l9n4.1626341a2af81bbd.yaml
         ├── elasticsearch-im-infra-1596020400-v98tk.1626341a2d821069.yaml
         ├── elasticsearch-im-app-1596020400-cc5vc.1626341a3019b238.yaml
         ├── elasticsearch-im-audit-1596020400-s8d5s.1626341a31f7b315.yaml
         ├── elasticsearch-im-infra-1596020400-7mgv8.1626341a35ea59ed.yaml
       ├── events.yaml
       ├── persistentvolumeclaims.yaml
       ├── pods.yaml
       ├── replicationcontrollers.yaml
       ├── secrets.yaml
       └── services.yaml
     ├── openshift-logging.yaml
     ├── pods
       ├── cluster-logging-operator-74dd5994f-6ttgt
         ├── cluster-logging-operator
           └── cluster-logging-operator
              └── logs
                 ├── current.log
                 ├── previous.insecure.log
                 └── previous.log
         └── cluster-logging-operator-74dd5994f-6ttgt.yaml
       ├── cluster-logging-operator-registry-6df49d7d4-mxxff
         ├── cluster-logging-operator-registry
           └── cluster-logging-operator-registry
              └── logs
                 ├── current.log
                 ├── previous.insecure.log
                 └── previous.log
         ├── cluster-logging-operator-registry-6df49d7d4-mxxff.yaml
         └── mutate-csv-and-generate-sqlite-db
            └── mutate-csv-and-generate-sqlite-db
               └── logs
                  ├── current.log
                  ├── previous.insecure.log
                  └── previous.log
       ├── elasticsearch-cdm-lp8l38m0-1-794d6dd989-4jxms
       ├── elasticsearch-im-app-1596030300-bpgcx
         ├── elasticsearch-im-app-1596030300-bpgcx.yaml
         └── indexmanagement
            └── indexmanagement
               └── logs
                  ├── current.log
                  ├── previous.insecure.log
                  └── previous.log
       ├── fluentd-2tr64
         ├── fluentd
           └── fluentd
              └── logs
                 ├── current.log
                 ├── previous.insecure.log
                 └── previous.log
         ├── fluentd-2tr64.yaml
         └── fluentd-init
            └── fluentd-init
               └── logs
                  ├── current.log
                  ├── previous.insecure.log
                  └── previous.log
       ├── kibana-9d69668d4-2rkvz
         ├── kibana
           └── kibana
              └── logs
                 ├── current.log
                 ├── previous.insecure.log
                 └── previous.log
         ├── kibana-9d69668d4-2rkvz.yaml
         └── kibana-proxy
            └── kibana-proxy
               └── logs
                  ├── current.log
                  ├── previous.insecure.log
                  └── previous.log
     └── route.openshift.io
        └── routes.yaml
   └── openshift-operators-redhat
      ├── ...
Enter fullscreen mode Exit fullscreen mode

Ref: https://docs.openshift.com/container-platform/4.12/support/gathering-cluster-data.html

Top comments (0)