TMAegisBêta
Plus de règles pour gke

Google Kubernetes Engine (GKE)

TMA-GKE-5.7.1

Enable Cloud Logging and Cloud Monitoring for GKE clusters

MoyenneNiveau 1Automatiséegke

Description

Enable Cloud Logging and Cloud Monitoring for GKE clusters so cluster, system, and workload telemetry is sent to centralized Google Cloud observability services. This helps preserve logs and metrics outside the cluster for troubleshooting, security, performance analysis, and alerts. Requires gcloud with container.clusters.get; the cluster comes from GKE_CLUSTER and GKE_LOCATION (optional GKE_PROJECT, else the gcloud default project).

Méthode de vérification

Méthode d'audit: Commande shell

shell
out=$(gcloud container clusters describe "${GKE_CLUSTER:?set GKE_CLUSTER}" --location "${GKE_LOCATION:?set GKE_LOCATION}" ${GKE_PROJECT:+--project=$GKE_PROJECT} --format='value(loggingService,monitoringService,loggingConfig.componentConfig.enableComponents.list(),monitoringConfig.componentConfig.enableComponents.list())') || exit 1
set -- $(printf '%s' "$out" | tr '\t' '|' | awk -F '|' '{for(i=1;i<=4;i++) printf "%s ", ($i=="" ? "-" : $i)}')
ok=1
case "$1" in none|-) ok=0;; esac
case "$2" in none|-) ok=0;; esac
case ",$3," in *SYSTEM_COMPONENTS*) ;; *) ok=0;; esac
case ",$3," in *WORKLOADS*) ;; *) ok=0;; esac
case ",$4," in *SYSTEM_COMPONENTS*) ;; *) ok=0;; esac
if [ "$ok" -eq 1 ]; then echo compliant; else echo "noncompliant: $out"; fi
Sortie attendue
compliant

Méthode de correction

Méthode de correction: Recommandation ou correctif d'infrastructure

Enable Cloud Logging and Cloud Monitoring for the required GKE components. At minimum, enable system logging and system monitoring so cluster operations, troubleshooting, and security investigations have centralized telemetry. Enable workload logging when application logs should be collected in Cloud Logging. gcloud container clusters update $CLUSTER_NAME \ --location $LOCATION \ --project $PROJECT_ID \ --logging=SYSTEM,WORKLOAD \ --monitoring=SYSTEM • Note: If additional observability is required, enable the appropriate monitoring components such as API server, scheduler, controller manager, kube state, cAdvisor, kubelet, storage, or GPU metrics based on the cluster’s operational requirements.

Propriétés

Systèmes d'exploitation
Tous
Étiquettes
gkemanaged-serviceslogging
Référence
CIS Google Kubernetes Engine (GKE) Benchmark v2.0.0 - 5.7.1 Enable Cloud Logging and Cloud Monitoring for GKE clusters

Vérifier cet hôte

Exécutez cette commande sur une machine que vous êtes autorisé à auditer. L'analyse est en lecture seule.

shell
tmaegis scan --target gke