Kubernetes cluster has CloudMonitor enabled
CloudMonitor agent provides visibility into system metrics for Kubernetes Engine clusters, including CPU, disk, network, and IO. Without it, operators lack observability into node and pod health. Enabling CloudMonitor creates a controller that collects metrics from each node's Pods and containers for analysis and alerting.
Risk
Without CloudMonitor, there is no automated collection of system metrics (CPU, memory, disk, network). This delays detection of resource exhaustion, node failures, and abnormal workloads, increasing risk of undetected availability issues. It also impairs identification of denial-of-service or cryptojacking on cluster nodes.
Run this check with Prowler
Run in Prowler Cloudprowler alibabacloud --checks cs_kubernetes_cloudmonitor_enabledRecommendation
Enable the CloudMonitor agent during cluster creation by setting CloudMonitor Agent to Enabled. For existing clusters, verify that cms_enabled is set to true for all node pools.
Remediation
CLI
aliyun cs GET /clusters/<cluster_id>/nodepools --header 'Content-Type=application/json' | jq '.nodepools[].kubernetes_config.cms_enabled'Other
Check Code
from prowler.lib.check.models import Check, CheckReportAlibabaCloud
from prowler.providers.alibabacloud.services.cs.cs_client import cs_client
class cs_kubernetes_cloudmonitor_enabled(Check):
"""Check if CloudMonitor is enabled on Kubernetes Engine Clusters."""
def execute(self) -> list[CheckReportAlibabaCloud]:
findings = []
for cluster in cs_client.clusters:
report = CheckReportAlibabaCloud(metadata=self.metadata(), resource=cluster)
report.region = cluster.region
report.resource_id = cluster.id
report.resource_arn = f"acs:cs:{cluster.region}:{cs_client.audited_account}:cluster/{cluster.id}"
if cluster.cloudmonitor_enabled:
report.status = "PASS"
report.status_extended = f"Kubernetes cluster {cluster.name} has CloudMonitor Agent enabled on all node pools."
else:
report.status = "FAIL"
report.status_extended = f"Kubernetes cluster {cluster.name} does not have CloudMonitor Agent enabled on all node pools."
findings.append(report)
return findings