5.4. Disabling admission controller enforcement
You can disable admission controller enforcement on a cluster when installing RHACS. For clusters that you did not install by using the Operator or Helm, you can disable admission controller enforcement from the Clusters view on the Red Hat Advanced Cluster Security for Kubernetes (RHACS) portal.
Procedure
-
For a cluster that was installed by using the Operator, in the
SecuredClustercustom resource (CR), edit thespec.admissionControl.enforcementparameter toDisabled. For a cluster that was installed by using Helm, in the
values-public.yamlfile, set theadmissionControl.enforcevalue tofalseand run the following command:helm upgrade -n stackrox \ stackrox-secured-cluster-services rhacs/secured-cluster-services \ --reuse-values \ -f /config/yaml/values-public.yaml \ -f /config/yaml/values-private.yamlFor clusters that are not managed by the Operator or Helm, you can use the RHACS portal to change this setting:
-
In the RHACS portal, select Platform Configuration
Clusters. - Select an existing cluster from the list.
In the Dynamic configuration section, in the Admission controller enforcement behavior field, select one of the following options:
- Enforce policies: The admission controller enforces policies that are configured for enforcement by rejecting the workload admission or update attempt.
- No enforcement: Even if enforcement is configured for a policy, if this option is selected, the admission controller does not enforce the policy and allows workload admission attempts or updates that violate the policy.
- Select Next.
- Select Finish.
-
In the RHACS portal, select Platform Configuration
5.4.1. Disabling associated policies 复制链接链接已复制到粘贴板!
You can turn off the enforcement on relevant policies, which in turn instructs the admission controller to skip enforcements.
Procedure
-
In the RHACS portal, go to Platform Configuration
Policy Management. Disable enforcement on the default policies:
-
In the policies view, locate the Kubernetes Actions: Exec into Pod policy. Click the overflow menu,
, and then select Disable policy.
-
In the policies view, locate the Kubernetes Actions: Port Forward to Pod policy. Click the overflow menu,
, and then select Disable policy.
-
In the policies view, locate the Kubernetes Actions: Exec into Pod policy. Click the overflow menu,
- Disable enforcement on any other custom policies that you have created by using criteria from the default Kubernetes Actions: Port Forward to Pod and Kubernetes Actions: Exec into Pod policies.
5.4.2. Disabling the webhook 复制链接链接已复制到粘贴板!
You can disable admission controller enforcement from the Clusters view in the RHACS portal.
If you disable the admission controller by turning off the webhook, you must redeploy the Sensor bundle.
Procedure
-
In the RHACS portal, go to Platform Configuration
Clusters. - Select an existing cluster from the list.
- Turn off the Enable Admission Controller Webhook to listen on exec and port-forward events toggle in the Static Configuration section.
- Select Next to continue with Sensor setup.
- Click Download YAML file and keys.
From a system that has access to the monitored cluster, extract and run the
sensorscript:$ unzip -d sensor sensor-<cluster_name>.zip$ ./sensor/sensor.sh注意If you get a warning that you do not have the required permissions to deploy the sensor, follow the on-screen instructions, or contact your cluster administrator for help.
After the sensor is deployed, it contacts Central and provides cluster information.
Return to the RHACS portal and check if the deployment is successful. If it is successful, a green checkmark appears under section #2. If you do not see a green checkmark, use the following command to check for problems:
On OpenShift Container Platform:
$ oc get pod -n stackrox -wOn Kubernetes:
$ kubectl get pod -n stackrox -w
- Select Finish.
When you disable the admission controller, RHACS does not delete the ValidatingWebhookConfiguration parameter. However, instead of checking requests for violations, it accepts all AdmissionReview requests.
To remove the ValidatingWebhookConfiguration object, run the following command in the secured cluster:
On OpenShift Container Platform:
$ oc delete ValidatingWebhookConfiguration/stackroxOn Kubernetes:
$ kubectl delete ValidatingWebhookConfiguration/stackrox