|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * security/compliance_operator/compliance-operator-remediation.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="compliance-custom-node-pools_{context}"] |
| 7 | += Scanning custom node pools |
| 8 | + |
| 9 | +The Compliance Operator does not maintain a copy of each node pool configuration. The Compliance Operator aggregates consistent configuration options for all nodes within a single node pool into one copy of the configuration file. The Compliance Operator then uses the configuration file for a particular node pool to evaluate rules against nodes within that pool. |
| 10 | + |
| 11 | +If your cluster uses custom node pools outside the default `worker` and `master` node pools, you must supply additional variables to ensure the Compliance Operator aggregates a configuration file for that node pool. |
| 12 | + |
| 13 | +.Procedure |
| 14 | + |
| 15 | +. To check the configuration against all pools in an example cluster containing `master`, `worker`, and custom `example` node pools, set the value of the `ocp-var-role-master` and `opc-var-role-worker` fields to `example` in the `TailoredProfile` object: |
| 16 | ++ |
| 17 | +[source,yaml] |
| 18 | +---- |
| 19 | +apiVersion: compliance.openshift.io/v1alpha1 |
| 20 | +kind: TailoredProfile |
| 21 | +metadata: |
| 22 | + name: cis-example-tp |
| 23 | +spec: |
| 24 | + extends: ocp4-cis |
| 25 | + title: My modified NIST profile to scan example nodes |
| 26 | + setValues: |
| 27 | + - name: ocp4-var-role-master |
| 28 | + value: example |
| 29 | + rationale: test for example nodes |
| 30 | + - name: ocp4-var-role-worker |
| 31 | + value: example |
| 32 | + rationale: test for example nodes |
| 33 | + description: cis-example-scan |
| 34 | +---- |
| 35 | + |
| 36 | +. Add the `example` role to the `ScanSetting` object that will be stored in the `ScanSettingBinding` CR: |
| 37 | ++ |
| 38 | +[source,yaml] |
| 39 | +---- |
| 40 | +apiVersion: compliance.openshift.io/v1alpha1 |
| 41 | +kind: ScanSetting |
| 42 | +metadata: |
| 43 | + name: default |
| 44 | + namespace: openshift-compliance |
| 45 | +rawResultStorage: |
| 46 | + rotation: 3 |
| 47 | + size: 1Gi |
| 48 | +roles: |
| 49 | +- worker |
| 50 | +- master |
| 51 | +- example |
| 52 | +scanTolerations: |
| 53 | +- effect: NoSchedule |
| 54 | + key: node-role.kubernetes.io/master |
| 55 | + operator: Exists |
| 56 | +schedule: '0 1 * * *' |
| 57 | +---- |
| 58 | + |
| 59 | +. Create a scan that uses the `ScanSettingBinding` CR: |
| 60 | ++ |
| 61 | +[source,yaml] |
| 62 | +---- |
| 63 | +apiVersion: compliance.openshift.io/v1alpha1 |
| 64 | +kind: ScanSettingBinding |
| 65 | +metadata: |
| 66 | + name: cis |
| 67 | + namespace: openshift-compliance |
| 68 | +profiles: |
| 69 | +- apiGroup: compliance.openshift.io/v1alpha1 |
| 70 | + kind: Profile |
| 71 | + name: ocp4-cis |
| 72 | +- apiGroup: compliance.openshift.io/v1alpha1 |
| 73 | + kind: Profile |
| 74 | + name: ocp4-cis-node |
| 75 | +- apiGroup: compliance.openshift.io/v1alpha1 |
| 76 | + kind: TailoredProfile |
| 77 | + name: cis-example-tp |
| 78 | +settingsRef: |
| 79 | + apiGroup: compliance.openshift.io/v1alpha1 |
| 80 | + kind: ScanSetting |
| 81 | + name: default |
| 82 | +---- |
| 83 | + |
| 84 | +The Compliance Operator checks the runtime `KubeletConfig` through the `Node/Proxy` API object and then uses variables such as `ocp-var-role-master` and `ocp-var-role-worker` to determine the nodes it performs the check against. In the `ComplianceCheckResult`, the `KubeletConfig` rules are shown as `ocp4-cis-kubelet-*`. The scan passes only if all selected nodes pass this check. |
| 85 | + |
| 86 | +.Verification |
| 87 | + |
| 88 | +* The Platform KubeletConfig rules are checked through the `Node/Proxy` object. You can find those rules by running the following command: |
| 89 | ++ |
| 90 | +[source,terminal] |
| 91 | +---- |
| 92 | +$ oc get rules -o json | jq '.items[] | select(.checkType == "Platform") | select(.metadata.name | contains("ocp4-kubelet-")) | .metadata.name' |
| 93 | +---- |
| 94 | +
|
0 commit comments