Description
For a new GKE Standard cluster, set monitoring_service: monitoring.googleapis.com/kubernetes to select Cloud Monitoring. If the task omits this setting, GKE can apply its default.
Potential impact
Without the required metrics, it can be hard to tell when nodes are running short of CPU or memory.
Remediation
For an existing cluster, use gcloud container clusters update with --monitoring to choose the required components. Find a recent node metric for that cluster in Metrics Explorer. If you need notifications, configure an alert policy and its recipients.
Examples
my-cluster1 uses defaults and my-cluster2 disables collection with none. The final task creates a different cluster, my-cluster. Supply the actual project and the path to a protected service-account JSON file.
Before
- name: create a cluster1
google.cloud.gcp_container_cluster:
name: my-cluster1
initial_node_count: 2
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project_id }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_credentials_file }}"
state: present
- name: create a cluster2
google.cloud.gcp_container_cluster:
name: my-cluster2
initial_node_count: 2
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project_id }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_credentials_file }}"
state: present
monitoring_service: none
After
- name: create a cluster
google.cloud.gcp_container_cluster:
name: my-cluster
initial_node_count: 2
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project_id }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_credentials_file }}"
state: present
monitoring_service: monitoring.googleapis.com/kubernetes