説明
新しい GKE Standard クラスターでは monitoring_service: monitoring.googleapis.com/kubernetes で Cloud Monitoring を指定します。タスクでこの設定を省略した場合は、GKE の既定値が適用されることがあります。
想定される影響
必要なメトリクスがないと、ノードの CPU やメモリが不足し始めた時点を把握しにくくなります。
対処方法
既存クラスターでは gcloud container clusters update の --monitoring で必要なコンポーネントを選びます。Metrics Explorer で対象クラスターの最近のノードメトリクスを確認してください。通知が必要ならアラートポリシーと通知先を設定します。
例
my-cluster1 は既定値を使い、my-cluster2 は none で収集を無効にします。最後のタスクは別の my-cluster を作成します。実際のプロジェクトと保護されたサービスアカウントの JSON ファイルのパスを指定してください。
変更前
yaml
- 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
変更後
yaml
- 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