OpenShift の様々な操作で使用する oc
コマンドの adm must-gather
をご紹介します。
adm must-gather
adm must-gather
は 問題の解析に必要な情報を一括取得します。
The oc adm must-gather CLI command collects the information from your cluster that is most likely needed for debugging issues, including:
Resource definitions
Service logsBy default, the oc adm must-gather command uses the default plugin image and writes into ./must-gather.local.
$ oc adm must-gather --help
Launch a pod to gather debugging information.
This command will launch a pod in a temporary namespace on your cluster that gathers debugging information and then
downloads the gathered information.
Experimental: This command is under active development and may change without notice.
Examples:
# Gather information using the default plug-in image and command, writing into ./must-gather.local.<rand>
oc adm must-gather
# Gather information with a specific local folder to copy to
oc adm must-gather --dest-dir=/local/directory
# Gather audit information
oc adm must-gather -- /usr/bin/gather_audit_logs
# Gather information using multiple plug-in images
oc adm must-gather --image=quay.io/kubevirt/must-gather --image=quay.io/openshift/origin-must-gather
# Gather information using a specific image stream plug-in
oc adm must-gather --image-stream=openshift/must-gather:latest
# Gather information using a specific image, command, and pod directory
oc adm must-gather --image=my/image:tag --source-dir=/pod/directory -- myspecial-command.sh
Options:
--dest-dir='':
Set a specific directory on the local machine to write gathered data to.
--host-network=false:
Run must-gather pods as hostNetwork: true - relevant if a specific command and image needs to capture
host-level data
--image=[]:
Specify a must-gather plugin image to run. If not specified, OpenShift's default must-gather image will be
used.
--image-stream=[]:
Specify an image stream (namespace/name:tag) containing a must-gather plugin image to run.
--node-name='':
Set a specific node to use - by default a random master will be used
--node-selector='':
Set a specific node selector to use - only relevant when specifying a command and image which needs to capture
data on a set of cluster nodes simultaneously
--run-namespace='':
An existing privileged namespace where must-gather pods should run. If not specified a temporary namespace
will be generated.
--source-dir='/must-gather/':
Set the specific directory on the pod copy the gathered data from.
--timeout='10m':
The length of time to gather data, like 5s, 2m, or 3h, higher than zero. Defaults to 10 minutes.
Usage:
oc adm must-gather [flags] [options]
Use "oc options" for a list of global command-line options (applies to all commands).
一般的な使用例
ここでは、一般的な使用例として --dest-dir=
オプションを使用してみます。この指定では、専用の Namespace が作成された上で must-gahter Pod が任意の Master Node で実行され、完了後に該当 Namespace が削除されます。
既存の Namespace を指定したい場合は --run-namespace=
オプションを指定します。
Master Node を指定したい場合は --node-name=
オプションを指定します。
$ oc adm must-gather --dest-dir=/tmp/MUST-GATHER
[must-gather ] OUT Using must-gather plug-in image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:42e18f51c6b852a2d71e41e4c3906e96b6a799af0e33634207e4d46430cf36d3
When opening a support case, bugzilla, or issue please include the following summary data along with any other requested information:
ClusterID: a33c8429-00e2-442f-be52-a68255d236fb
ClientVersion: 4.14.0-202404250639.p0.gf7b14a9.assembly.stream.el8-f7b14a9
ClusterVersion: Stable at "4.14.39"
ClusterOperators:
clusteroperator/authentication is missing
clusteroperator/cloud-credential is missing
clusteroperator/cluster-autoscaler is missing
clusteroperator/config-operator is missing
clusteroperator/etcd is missing
clusteroperator/machine-api is missing
clusteroperator/machine-approver is missing
clusteroperator/machine-config is missing
[must-gather ] OUT namespace/openshift-must-gather-bps6v created
[must-gather ] OUT clusterrolebinding.rbac.authorization.k8s.io/must-gather-9pnm9 created
[must-gather ] OUT pod for plug-in image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:42e18f51c6b852a2d71e41e4c3906e96b6a799af0e33634207e4d46430cf36d3 created
[must-gather-4xcms] POD 2024-12-05T18:53:58.994020369-06:00 Gathering data for ns/openshift-cluster-version...
[must-gather-4xcms] POD 2024-12-05T18:53:59.425855440-06:00 Warning: apps.openshift.io/v1 DeploymentConfig is deprecated in v4.14+, unavailable in v4.10000+
~中略~
[must-gather-4xcms] OUT namespaces/openshift-image-registry/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/openshift-image-registry.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/app.k8s.io/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/app.k8s.io/applications.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/apps.openshift.io/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/apps.openshift.io/deploymentconfigs.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/apps/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/apps/daemonsets.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/apps/deployments.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/apps/replicasets.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/apps/statefulsets.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/autoscaling/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/autoscaling/horizontalpodautoscalers.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/batch/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/batch/cronjobs.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/batch/jobs.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/build.openshift.io/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/build.openshift.io/buildconfigs.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/build.openshift.io/builds.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/configmaps.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/endpoints.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/events.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/persistentvolumeclaims.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/pods.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/replicationcontrollers.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/secrets.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/core/services.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/discovery.k8s.io/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/discovery.k8s.io/endpointslices.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/image.openshift.io/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/image.openshift.io/imagestreams.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/monitoring.coreos.com/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/monitoring.coreos.com/servicemonitors.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/monitoring.coreos.com/prometheusrules/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/monitoring.coreos.com/prometheusrules/image-registry-rules.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/monitoring.coreos.com/prometheusrules/imagestreams-rules.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/monitoring.coreos.com/servicemonitors/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/monitoring.coreos.com/servicemonitors/image-registry-operator.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/monitoring.coreos.com/servicemonitors/image-registry.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/networking.k8s.io/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/networking.k8s.io/networkpolicies.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/operators.coreos.com/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/operators.coreos.com/clusterserviceversions/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/operators.coreos.com/clusterserviceversions/kiali-operator.v1.89.1.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/operators.coreos.com/clusterserviceversions/rhods-operator.2.14.0.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/operators.coreos.com/clusterserviceversions/serverless-operator.v1.32.1.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/operators.coreos.com/clusterserviceversions/servicemeshoperator.v2.6.1.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/operators.coreos.com/clusterserviceversions/tempo-operator.v0.10.0-6.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/cluster-image-registry-operator-779868f968-q5sx2/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/cluster-image-registry-operator-779868f968-q5sx2/cluster-image-registry-operator-779868f968-q5sx2.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/cluster-image-registry-operator-779868f968-q5sx2/cluster-image-registry-operator/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/cluster-image-registry-operator-779868f968-q5sx2/cluster-image-registry-operator/cluster-image-registry-operator/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/cluster-image-registry-operator-779868f968-q5sx2/cluster-image-registry-operator/cluster-image-registry-operator/logs/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/cluster-image-registry-operator-779868f968-q5sx2/cluster-image-registry-operator/cluster-image-registry-operator/logs/current.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/cluster-image-registry-operator-779868f968-q5sx2/cluster-image-registry-operator/cluster-image-registry-operator/logs/previous.insecure.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/cluster-image-registry-operator-779868f968-q5sx2/cluster-image-registry-operator/cluster-image-registry-operator/logs/previous.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28887840-p876l/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28887840-p876l/image-pruner-28887840-p876l.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28887840-p876l/image-pruner/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28887840-p876l/image-pruner/image-pruner/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28887840-p876l/image-pruner/image-pruner/logs/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28887840-p876l/image-pruner/image-pruner/logs/current.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28887840-p876l/image-pruner/image-pruner/logs/previous.insecure.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28887840-p876l/image-pruner/image-pruner/logs/previous.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28889280-zjrrr/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28889280-zjrrr/image-pruner-28889280-zjrrr.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28889280-zjrrr/image-pruner/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28889280-zjrrr/image-pruner/image-pruner/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28889280-zjrrr/image-pruner/image-pruner/logs/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28889280-zjrrr/image-pruner/image-pruner/logs/current.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28889280-zjrrr/image-pruner/image-pruner/logs/previous.insecure.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28889280-zjrrr/image-pruner/image-pruner/logs/previous.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28890720-clfpm/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28890720-clfpm/image-pruner-28890720-clfpm.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28890720-clfpm/image-pruner/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28890720-clfpm/image-pruner/image-pruner/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28890720-clfpm/image-pruner/image-pruner/logs/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28890720-clfpm/image-pruner/image-pruner/logs/current.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28890720-clfpm/image-pruner/image-pruner/logs/previous.insecure.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-pruner-28890720-clfpm/image-pruner/image-pruner/logs/previous.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/image-registry-64c4f94457-67lvq.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/registry/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/registry/logs/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/registry/logs/current.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/registry/logs/previous.insecure.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/registry/logs/previous.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/registry/logs/rotated/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/registry/logs/rotated/0.log.20241124-011441.gz
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/image-registry-64c4f94457-67lvq/registry/registry/logs/rotated/0.log.20241129-213653
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-hq9cm/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-hq9cm/node-ca-hq9cm.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-hq9cm/node-ca/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-hq9cm/node-ca/node-ca/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-hq9cm/node-ca/node-ca/logs/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-hq9cm/node-ca/node-ca/logs/current.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-hq9cm/node-ca/node-ca/logs/previous.insecure.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-hq9cm/node-ca/node-ca/logs/previous.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-kqjn2/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-kqjn2/node-ca-kqjn2.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-kqjn2/node-ca/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-kqjn2/node-ca/node-ca/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-kqjn2/node-ca/node-ca/logs/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-kqjn2/node-ca/node-ca/logs/current.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-kqjn2/node-ca/node-ca/logs/previous.insecure.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-kqjn2/node-ca/node-ca/logs/previous.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-tcr97/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-tcr97/node-ca-tcr97.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-tcr97/node-ca/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-tcr97/node-ca/node-ca/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-tcr97/node-ca/node-ca/logs/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-tcr97/node-ca/node-ca/logs/current.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-tcr97/node-ca/node-ca/logs/previous.insecure.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/pods/node-ca-tcr97/node-ca/node-ca/logs/previous.log
[must-gather-4xcms] OUT namespaces/openshift-image-registry/policy/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/policy/poddisruptionbudgets.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/ray.io/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/ray.io/rayclusters.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/ray.io/rayjobs.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/ray.io/rayservices.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/route.openshift.io/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/route.openshift.io/routes.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/serving.knative.dev/
[must-gather-4xcms] OUT namespaces/openshift-image-registry/serving.knative.dev/configurations.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/serving.knative.dev/domainmappings.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/serving.knative.dev/revisions.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/serving.knative.dev/routes.yaml
[must-gather-4xcms] OUT namespaces/openshift-image-registry/serving.knative.dev/services.yaml
~中略~
[must-gather-4xcms] OUT sent 79,078 bytes received 339,012,952 bytes 5,425,472.48 bytes/sec
[must-gather-4xcms] OUT total size is 3,400,731,790 speedup is 10.03
[must-gather ] OUT namespace/openshift-must-gather-bps6v deleted
[must-gather ] OUT clusterrolebinding.rbac.authorization.k8s.io/must-gather-9pnm9 deleted
Reprinting Cluster State:
When opening a support case, bugzilla, or issue please include the following summary data along with any other requested information:
ClusterID: a33c8429-00e2-442f-be52-a68255d236fb
ClientVersion: 4.14.0-202404250639.p0.gf7b14a9.assembly.stream.el8-f7b14a9
ClusterVersion: Stable at "4.14.39"
ClusterOperators:
clusteroperator/authentication is missing
clusteroperator/cloud-credential is missing
clusteroperator/cluster-autoscaler is missing
clusteroperator/config-operator is missing
clusteroperator/etcd is missing
clusteroperator/machine-api is missing
clusteroperator/machine-approver is missing
clusteroperator/machine-config is missing
今回の実行では、以下の Namespace が作成されました。
[must-gather ] OUT namespace/openshift-must-gather-bps6v created
$ oc -o yaml get ns openshift-must-gather-bps6v
apiVersion: v1
kind: Namespace
metadata:
annotations:
oc.openshift.io/command: oc adm must-gather
openshift.io/node-selector: ""
openshift.io/sa.scc.mcs: s0:c27,c24
openshift.io/sa.scc.supplemental-groups: 1000750000/10000
openshift.io/sa.scc.uid-range: 1000750000/10000
generateName: openshift-must-gather-
labels:
kubernetes.io/metadata.name: openshift-must-gather-bps6v
openshift.io/run-level: "0"
pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/warn: privileged
security.openshift.io/scc.podSecurityLabelSync: "false"
name: openshift-must-gather-bps6v
spec:
finalizers:
- kubernetes
status:
phase: Active
上記 Namespace で以下の Pod が実行されます。
$ oc get all -n openshift-must-gather-bps6v
Warning: apps.openshift.io/v1 DeploymentConfig is deprecated in v4.14+, unavailable in v4.10000+
NAME READY STATUS RESTARTS AGE
pod/must-gather-4xcms 2/2 Running 0 20s
$ oc -o yaml get all -n openshift-must-gather-bps6v
Warning: apps.openshift.io/v1 DeploymentConfig is deprecated in v4.14+, unavailable in v4.10000+
apiVersion: v1
items:
- apiVersion: v1
kind: Pod
metadata:
annotations:
cni.projectcalico.org/containerID: 1d88dd7cffc82e66a4d7b4f493696736c4e9c9b15f910177fba51c8c07bed4ba
cni.projectcalico.org/podIP: 111.22.33.157/32
cni.projectcalico.org/podIPs: 111.22.33.157/32
k8s.v1.cni.cncf.io/network-status: |-
[{
"name": "k8s-pod-network",
"ips": [
"111.22.33.157"
],
"default": true,
"dns": {}
}]
generateName: must-gather-
labels:
app: must-gather
name: must-gather-4xcms
namespace: openshift-must-gather-bps6v
resourceVersion: "371860030"
spec:
containers:
- command:
- /bin/bash
- -c
- /usr/bin/gather; sync
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:42e18f51c6b852a2d71e41e4c3906e96b6a799af0e33634207e4d46430cf36d3
imagePullPolicy: IfNotPresent
name: gather
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /must-gather
name: must-gather-output
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: kube-api-access-sptvp
readOnly: true
- command:
- /bin/bash
- -c
- 'trap : TERM INT; sleep infinity & wait'
image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:42e18f51c6b852a2d71e41e4c3906e96b6a799af0e33634207e4d46430cf36d3
imagePullPolicy: IfNotPresent
name: copy
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /must-gather
name: must-gather-output
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: kube-api-access-sptvp
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
nodeName: 66.777.128.5
nodeSelector:
kubernetes.io/os: linux
node-role.kubernetes.io/master: ""
preemptionPolicy: PreemptLowerPriority
priority: 2000000000
priorityClassName: system-cluster-critical
restartPolicy: Never
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 0
tolerations:
- operator: Exists
volumes:
- emptyDir: {}
name: must-gather-output
- name: kube-api-access-sptvp
projected:
defaultMode: 420
sources:
- serviceAccountToken:
expirationSeconds: 3607
path: token
- configMap:
items:
- key: ca.crt
path: ca.crt
name: kube-root-ca.crt
- downwardAPI:
items:
- fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
path: namespace
- configMap:
items:
- key: service-ca.crt
path: service-ca.crt
name: openshift-service-ca.crt
status:
conditions:
- lastProbeTime: null
lastTransitionTime: "2024-12-06T00:53:55Z"
status: "True"
type: Initialized
~省略~
実行が完了すると、Namespace は削除されます。
$ oc get ns openshift-must-gather-bps6v
Error from server (NotFound): namespaces "openshift-must-gather-bps6v" not found
取得された情報は、以下のようになっています。
$ pwd
/tmp/MUST-GATHER
$ du -csb .
3401681968 .
3401681968 total
$ ls -l
total 284
-rw-------. 1 root root 281522 Dec 6 10:03 event-filter.html
drwxrwxrwx. 13 root root 4096 Dec 6 10:03 quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256-42e18f51c6b852a2d71e41e4c3906e96b6a799af0e33634207e4d46430cf36d3
-rw-------. 1 root root 112 Dec 6 10:03 timestamp
$ cat timestamp
2024-12-06 09:53:55.434904404 +0900 JST m=+0.383016784
2024-12-06 10:03:41.367587278 +0900 JST m=+586.315699640
$ ls -l quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256-42e18f51c6b852a2d71e41e4c3906e96b6a799af0e33634207e4d46430cf36d3
total 296
drwxr-xr-x. 17 root root 4096 Dec 6 10:02 cluster-scoped-resources
-rw-r--r--. 1 root root 281522 Dec 6 10:00 event-filter.html
drwxr-xr-x. 3 root root 21 Dec 6 10:02 host_service_logs
drwxr-xr-x. 3 root root 21 Dec 6 10:02 ingress_controllers
drwxr-xr-x. 3 root root 31 Dec 6 10:02 insights-data
drwxr-xr-x. 2 root root 6 Dec 6 10:02 machine_config_ondisk
drwxr-xr-x. 4 root root 44 Dec 6 10:02 monitoring
drwxr-xr-x. 88 root root 4096 Dec 6 10:03 namespaces
drwxr-xr-x. 3 root root 4096 Dec 6 10:03 network_logs
drwxr-xr-x. 5 root root 78 Dec 6 10:03 nodes
drwxr-xr-x. 2 root root 47 Dec 6 10:03 pod_network_connectivity_check
drwxr-xr-x. 3 root root 28 Dec 6 10:03 static-pods
-rw-r--r--. 1 root root 1432 Dec 6 10:00 timestamp
-rw-r--r--. 1 root root 82 Dec 6 09:53 version
例えば、openshift-image-registry
Project の情報は、以下に配置されています。
$ ls -l ./quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256-42e18f51c6b852a2d71e41e4c3906e96b6a799af0e33634207e4d46430cf36d3/namespaces/openshift-image-registry
total 16
drwxr-xr-x. 2 root root 31 Dec 6 10:03 app.k8s.io
drwxr-xr-x. 2 root root 102 Dec 6 10:03 apps
drwxr-xr-x. 2 root root 36 Dec 6 10:03 apps.openshift.io
drwxr-xr-x. 2 root root 43 Dec 6 10:03 autoscaling
drwxr-xr-x. 2 root root 44 Dec 6 10:03 batch
drwxr-xr-x. 2 root root 50 Dec 6 10:03 build.openshift.io
drwxr-xr-x. 2 root root 4096 Dec 6 10:03 core
drwxr-xr-x. 2 root root 33 Dec 6 10:03 discovery.k8s.io
drwxr-xr-x. 2 root root 31 Dec 6 10:03 image.openshift.io
drwxr-xr-x. 4 root root 80 Dec 6 10:03 monitoring.coreos.com
drwxr-xr-x. 2 root root 34 Dec 6 10:03 networking.k8s.io
-rwxr-xr-x. 1 root root 4328 Dec 6 09:57 openshift-image-registry.yaml
drwxr-xr-x. 3 root root 36 Dec 6 10:03 operators.coreos.com
drwxr-xr-x. 10 root root 4096 Dec 6 10:03 pods
drwxr-xr-x. 2 root root 39 Dec 6 10:03 policy
drwxr-xr-x. 2 root root 74 Dec 6 10:03 ray.io
drwxr-xr-x. 2 root root 25 Dec 6 10:03 route.openshift.io
drwxr-xr-x. 2 root root 122 Dec 6 10:03 serving.knative.dev
event-filter.html
では、取得された k8s Event が Filtering できるようになっています。
must-gather Plugin Image (Container) を指定する例
adm must-gather
は OpenShift の情報を取得しますが、--image=
オプションを使用する事で、異なる処理が可能です。
例えば、OpenShift Data Foundation (ODF) 4.14 の情報を取得する場合は、以下のように指定します。
$ oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.14 --dest-dir=<directory-name>