|
5 | 5 |
|
6 | 6 | :_mod-docs-content-type: PROCEDURE |
7 | 7 | [id="running-insights-operator-gather-openshift-cli_{context}"] |
8 | | -= Running an Insights Operator gather operation from the OpenShift CLI |
9 | | -You can run an Insights Operator gather operation by using the {product-title} command-line interface. |
| 8 | += Gathering data on demand with the Insights Operator from the OpenShift CLI |
| 9 | + |
| 10 | +You can run a custom Insights Operator gather operation on-demand from the {product-title} command-line interface (CLI). |
| 11 | +An on-demand `DataGather` operation is useful for one-off data collections that require different configurations to the periodic data gathering (`InsightsDataGather`) specification. |
| 12 | + |
| 13 | +Use the following procedure to create a `DataGather` custom resource definition (CRD), and then run the data gather operation on demand from the CLI. |
10 | 14 |
|
11 | 15 | .Prerequisites |
12 | 16 |
|
13 | 17 | * You are logged in to {product-title} as a user with the `cluster-admin` role. |
14 | 18 |
|
15 | 19 | .Procedure |
16 | | -* Enter the following command to run the gather operation: |
| 20 | + |
| 21 | +. Create a YAML file with the following `DataGather` specification: |
17 | 22 | + |
18 | | -[source,terminal] |
| 23 | +[source,yaml] |
19 | 24 | ---- |
20 | | -$ oc apply -f <your_datagather_definition>.yaml |
| 25 | + |
| 26 | +apiVersion: insights.openshift.io/v1alpha2 |
| 27 | +kind: DataGather |
| 28 | +metadata: |
| 29 | + name: <your_data_gather> |
| 30 | +spec: |
| 31 | +# Gatherers configuration |
| 32 | + gatherers: |
| 33 | + mode: All # Options: All, Custom |
| 34 | +# ... |
21 | 35 | ---- |
22 | 36 | + |
23 | | -Replace `<your_datagather_definition>.yaml` with a configuration file that contains the following parameters: |
| 37 | +[IMPORTANT] |
| 38 | +==== |
| 39 | +* The name you specify for your gather operation, `<your_data_gather>`, must be unique and must not include a prefix of `periodic-gathering-` because this string is reserved for other administrative operations and might impact the intended gather operation. |
| 40 | +* If the `spec` of `DataGather` CRD is undefined, the default Insights Operator data collection job will run. This means that all gather operations will run, the collected data will be unobfuscated and the archive file will not be retained. |
| 41 | +==== |
| 42 | ++ |
| 43 | +. Optional: To customize the data gather operation, you can configure any of the following options in your `DataGather` YAML file: |
| 44 | +* To disable specific gatherers, change the value of `mode` to *Custom*, and then specify the individual gatherer that you intend to disable. For example, to disable the workload gatherer, add the following example: |
24 | 45 | + |
25 | 46 | [source,yaml] |
26 | 47 | ---- |
27 | | -apiVersion: insights.openshift.io/v1alpha1 |
| 48 | +apiVersion: insights.openshift.io/v1alpha2 |
28 | 49 | kind: DataGather |
29 | 50 | metadata: |
30 | | - name: <your_data_gather> <1> |
| 51 | + name: <your_data_gather> |
31 | 52 | spec: |
32 | | - gatherers: <2> |
33 | | - - name: workloads |
34 | | - state: Disabled |
| 53 | + # Gatherers configuration |
| 54 | + gatherers: |
| 55 | + mode: Custom # Options: All, Custom |
| 56 | + custom: |
| 57 | + configs: |
| 58 | + # Essential cluster configuration gatherers |
| 59 | + - name: clusterconfig/authentication |
| 60 | + state: Enabled |
| 61 | + - name: clusterconfig/clusteroperators |
| 62 | + state: Enabled |
| 63 | + - name: workloads |
| 64 | + state: Disabled |
| 65 | +---- |
| 66 | +* To enable persistent storage to retain the data archive file and history for up to the last 10 data gathering jobs, define the `storage` specification. Set *type* to `PersistentVolume`, and define the `mountPath` and `name` of the volume, as outlined in the following example: |
| 67 | ++ |
| 68 | +[source,yaml] |
| 69 | +---- |
| 70 | +apiVersion: insights.openshift.io/v1alpha2 |
| 71 | +kind: DataGather |
| 72 | +metadata: |
| 73 | + name: <your_data_gather> |
| 74 | +spec: |
| 75 | + storage: |
| 76 | + type: PersistentVolume |
| 77 | + mountPath: /data |
| 78 | + persistentVolume: |
| 79 | + claim: |
| 80 | + name: on-demand-gather-pvc |
35 | 81 | ---- |
36 | 82 | + |
37 | | --- |
38 | | -<1> Under *metadata*, replace `<your_data_gather>` with a unique name for the gather operation. |
39 | | -<2> Under *gatherers*, specify any individual gather operations that you intend to disable. In the example provided, `workloads` is the only data gather operation that is disabled and all of the other default operations are set to run. |
40 | | -When the `spec` parameter is empty, all of the default gather operations run. |
41 | | --- |
42 | | -
|
43 | 83 | [IMPORTANT] |
44 | 84 | ==== |
45 | | -Do not add a prefix of `periodic-gathering-` to the name of your gather operation because this string is reserved for other administrative operations and might impact the intended gather operation. |
| 85 | +Ensure that the volume name specified matches the existing `PersistentVolumeClaim` value in the `openshift-insights` namespace. For more information, see link:https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html/storage/understanding-persistent-storage#persistent-volume-claims_understanding-persistent-storage[Persistent volume claims]. |
46 | 86 | ==== |
| 87 | ++ |
| 88 | +* To enable data obfuscation, define the `dataPolicy` key and required values. For example, to obfuscate IP addresses and workload names, add the following configuration: |
| 89 | ++ |
| 90 | +[source,yaml] |
| 91 | +---- |
| 92 | +apiVersion: insights.openshift.io/v1alpha2 |
| 93 | +kind: DataGather |
| 94 | +metadata: |
| 95 | + name: <your_data_gather> |
| 96 | +spec: |
| 97 | + dataPolicy: |
| 98 | + - ObfuscateNetworking |
| 99 | + - WorkloadNames |
| 100 | +---- |
| 101 | ++ |
| 102 | +. On the {product-title} CLI, enter the following command to run the gather operation: |
| 103 | ++ |
| 104 | +[source,terminal] |
| 105 | +---- |
| 106 | +$ oc apply -f <your_data_gather_definition>.yaml |
| 107 | +---- |
47 | 108 |
|
48 | 109 | .Verification |
49 | 110 |
|
|
0 commit comments