GKE Exposed Service Created With Type NodePort
Description
Detects creation or modification of a GKE Service with type NodePort. NodePort exposes a static port on every worker node that hosts matching pods, which widens the cluster's external attack surface and can bypass load-balancer and firewall controls. Attackers may create NodePort Services to intercept traffic or establish a direct path into the cluster.
Query · kuery
data_stream.dataset:gcp.audit and service.name:"k8s.io" and event.outcome:success and event.action:( "io.k8s.core.v1.services.create" or "io.k8s.core.v1.services.update" or "io.k8s.core.v1.services.patch" ) and gcp.audit.request.spec.type:"NodePort" and not ( client.user.email:"system:addon-manager" and event.action:"io.k8s.core.v1.services.patch" )
Investigation fields
Pivot points the source recommends for triage.
@timestampclient.user.emailsource.ipuser_agent.originalevent.actionevent.outcomegcp.audit.resource_namegcp.audit.request.spec.typegcp.audit.requestdata_stream.namespace
Implementation guide
The GCP Fleet integration with GKE audit logs enabled is required. Request body capture for Service resources is
required so gcp.audit.request.spec.type is populated.
Known false positives
- Developers may legitimately use NodePort for frontends without cloud load balancers, or for nonstandard networking. system:addon-manager patch reconciliation of existing NodePort Services is excluded; create and update from addon-manager still alert.
Analyst notes
Investigating GKE Exposed Service Created With Type NodePort
NodePort opens a port on each worker node hosting the service and forwards external traffic to labeled pods. Confirm whether the exposure was approved and which workloads are reachable.
Possible investigation steps
- Review
client.user.email,source.ip, anduser_agent.original. - Inspect
gcp.audit.resource_nameandgcp.audit.requestfor the service name, namespace, selector, and port. - Identify the backing pods and whether the NodePort is required for a legitimate external entrypoint.
- Correlate with recent Service or networking changes from the same actor.
False positive analysis
- Approved NodePort Services for lab frontends or custom load balancing may match. Allowlist known automation or namespaces after review.
- GKE addon reconciliation via
system:addon-managerpatch is excluded; unexpected create or update from that actor should still be investigated.
Response and remediation
- Remove or change unauthorized NodePort Services, revoke excess RBAC for Services writes, and review firewall exposure for the opened node ports.