GKE node pools should use Container-Optimized OS (COS) images. COS is a Google-managed, hardened OS with automatic security updates and tighter integration with GKE, reducing exposure to unpatched vulnerabilities and kernel-level attack surface.
In Ansible, check tasks using the google.cloud.gcp_container_node_pool or gcp_container_node_pool modules and ensure the config.image_type property is defined and starts with COS (case-insensitive). Tasks missing config.image_type or with values that do not start with COS are flagged.
Secure configuration example:
- name:Create GKE node pool with COS imagegoogle.cloud.gcp_container_node_pool:name:my-node-poolinitial_node_count:3config:machine_type:e2-mediumimage_type:COS_CONTAINERD
Compliant Code Examples
- name:create a node poolgoogle.cloud.gcp_container_node_pool:name:my-poolinitial_node_count:4cluster:'{{ cluster }}'location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:/tmp/auth.pemstate:presentconfig:image_type:COS
- name:create a node poolgoogle.cloud.gcp_container_node_pool:name:my-poolinitial_node_count:4cluster:"{{ cluster }}"location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:/tmp/auth.pemstate:presentconfig:image_type:COS_CONTAINERD
Non-Compliant Code Examples
---- name:create a node poolgoogle.cloud.gcp_container_node_pool:name:my-poolinitial_node_count:4cluster:"{{ cluster }}"location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:"/tmp/auth.pem"state:presentconfig:image_type:WINDOWS_LTSC
1
2
rulesets:- Ansible / GCP # Rules to enforce / GCP.
맞춤형 데모 요청
Datadog 시작하기
Ask AI
AI-generated responses may be inaccurate. Verify important info.