Inspect cluster workloads
Container Service for Kubernetes (ACK) provides the inspection feature to scan your cluster workloads for security risks in their configurations. After an inspection task runs, the system generates an inspection report. Use the report to view and address risk items and monitor workload health in real time.
Prerequisites
The cluster runs Kubernetes v1.14 or later. To upgrade your cluster, see Manually upgrade a cluster.
If you are a Resource Access Management (RAM) user, make sure that you have completed the RAM authorization and RBAC authorization described below.
RAM authorization
Complete the RAM authorization on the Inspections page, and make sure that the current RAM user has the permissions to use the Inspections page of the current cluster. Otherwise, insufficient permissions prevent you from using the features on the Inspections page. For more information, see Grant cluster and cloud resource access with RAM.
To use the inspection report feature, complete the RAM authorization for the specified Simple Log Service (SLS) project that the log collection add-on of the current cluster uses, and make sure that the current RAM user has read permissions on that project. Otherwise, insufficient permissions prevent you from viewing inspection reports. For more information, see RAM custom policy examples.
RBAC authorization
Complete the RBAC authorization for the resources on the Inspections page, and grant the RAM user administrator permissions on the specified cluster. This ensures that the RAM user has the permissions to operate on the Kubernetes resources involved on the Inspections page. For more information, see Authorize operations on in-cluster resources with RBAC.
Run an inspection
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
Optional: Follow the on-screen instructions to install and upgrade the inspection add-on.
The security-inspector add-on is free of charge, but it consumes your pod resources. For more information about the add-on and its release notes, see Security inspector.
Run an inspection.
ImportantRun inspections during off-peak hours.
By default, an inspection scans all supported inspection items. In the upper-right corner of the Inspections page, click Configure Periodic Inspection, and then specify the inspection items to run during the inspection. For more information, see Inspection items.
Run an inspection immediately: in the upper-right corner of the Inspections page, click Inspect.
Run periodic inspections: in the upper-right corner of the Inspections page, click Configure Periodic Inspection, and then select Configure Periodic Inspection, and configure the inspection period.
After the inspection is complete, on the Inspections tab, find the inspection result that you want to view. In the Actions column, click Details to view the check results.
Inspection details
Inspections page lists the detailed inspection results of different workloads in tables. The page provides the following features:
Filter results by criteria such as Passed or Failed, Namespace, and Workload Type, and view the inspection Number of Passed Items and Risk Item counts for each workload.
View the details of each inspection item, including the check status at the pod and container level (Passed or Failed), a detailed description of the item, and hardening suggestions. If a failed item does not need to be fixed, you can add it to the whitelist.
View the YAML file of a workload.
Inspection reports
Reports page displays the scan results of the most recent inspection. The page includes the following types of information:
An overview of the scan results, including the total number of inspection items, the number and percentage of each inspected resource type, and the overall health score.
Statistics for each major scan category, including health check, image, network, resource, and security results.
Detailed scan results for each workload configuration, including the resource type, resource name, namespace, check type, inspection item, and check result.
Inspection items
The configuration inspection feature scans for and displays the results of the following inspection items.
Inspection item ID | Inspection item | Description and security risk | Remediation |
hostNetworkSet | Prevent containers from sharing the host network namespace | Checks whether | Modify the pod spec to remove the Example: |
hostIPCSet | Prevent containers from sharing the host IPC namespace | Checks whether | Modify the pod spec to remove the Example: |
hostPIDSet | Prevent containers from sharing the host PID namespace | Checks whether | Modify the pod spec to remove the Example: |
hostPortSet | Prevent container processes from listening on host ports of the node | Checks whether | Modify the pod spec to remove the Example: |
runAsRootAllowed | Prevent containers from running as the root user | Checks whether | Modify the pod spec to add Example: |
runAsPrivileged | Prevent containers from running in privileged mode | Checks whether | Modify the pod spec to remove the Example: |
privilegeEscalationAllowed | Prevent child processes in a container from gaining elevated privileges | Checks whether | Modify the pod spec to add the Example: |
capabilitiesAdded | Drop unnecessary Linux capabilities | Checks the | Modify the pod spec to add only the Linux capabilities that your workloads require and drop the unnecessary ones. If no additional Linux capabilities are required, drop all of them. Example: If specific capabilities are required, add only the necessary ones and drop all the others. Example: |
notReadOnlyRootFileSystem | Make the container file system read-only | Checks whether | Modify the pod spec to add Example: To modify files in a specific directory, use the Example: |
cpuRequestsMissing | Set the minimum CPU resources required to run containers | Checks whether | Modify the pod spec to add the Example: |
cpuLimitsMissing | Limit the maximum CPU resources that containers can use | Checks whether | Modify the pod spec to add the Example: |
memoryRequestsMissing | Set the minimum memory resources required to run containers | Checks whether | Modify the pod spec to add the Example: |
memoryLimitsMissing | Limit the maximum memory resources that containers can use | Checks whether | Modify the pod spec to add the Example: |
readinessProbeMissing | Configure readiness probes for containers | Checks whether | Modify the pod spec to add the Example: |
livenessProbeMissing | Configure liveness probes for containers | Checks whether | Modify the pod spec to add the Example: |
tagNotSpecified | Use an explicit image version for containers | Checks whether the | Modify the pod spec and change the Example: |
anonymousUserRBACBinding | Prevent anonymous users from accessing the cluster | Checks the Role-Based Access Control (RBAC) bindings in the cluster for configuration items that grant access permissions to anonymous users. If a configuration item allows anonymous users to access cluster resources, a malicious anonymous user can exfiltrate sensitive cluster information and attack or intrude into the cluster. | Modify the RBAC bindings that the scan returns, and remove the permission configuration items that allow anonymous users to access cluster resources based on your business requirements. Example: |
Events
Event type | Event name | Content example | Description | Actions |
Normal | SecurityInspectorConfigAuditStart | Start to running config audit | The inspection task starts. | No action is required. |
Normal | SecurityInspectorConfigAuditFinished | Finished running once config audit | The inspection task is complete. | No action is required. |
Warning | SecurityInspectorConfigAuditHighRiskFound | 2 high risks have been found after running config audit | After the inspection runs, unfixed high-risk inspection items are found in some workloads. |
|