Agent Skillsgoogle/skills › gke-service-networking

gke-service-networking

GitHub

提供GKE服务网络配置工作流,包括Gateway API、标准Ingress、Cloud Armor WAF及SSL证书管理,用于安全暴露应用。

plugins/cloud/google-cloud-gke/skills/gke-service-networking/SKILL.md google/skills

Trigger Scenarios

配置 GKE Gateway API 设置标准 Ingress 部署 Cloud Armor WAF 配置 Google 托管 SSL 证书

Install

npx skills add google/skills --skill gke-service-networking -g -y
More Options

Non-standard path

npx skills add https://github.com/google/skills/tree/main/plugins/cloud/google-cloud-gke/skills/gke-service-networking -g -y

Use without installing

npx skills use google/skills@gke-service-networking

指定 Agent (Claude Code)

npx skills add google/skills --skill gke-service-networking -a claude-code -g -y

安装 repo 全部 skill

npx skills add google/skills --all -g -y

预览 repo 内 skill

npx skills add google/skills --list

SKILL.md

Frontmatter
{
    "name": "gke-service-networking",
    "metadata": {
        "category": "Networking"
    },
    "description": "Configures GKE edge networking, traffic routing, load balancing, and private service endpoints. Use when configuring Gateway API manifests, standard Ingress, Cloud Armor WAF security policies, Container-Native Load Balancing (NEGs), Private Service Connect (PSC), or Google-managed SSL certificates on GKE. Don't use for core cluster IP planning, Dataplane V2 network policies, or node NAT egress (use gke-networking instead)."
}

GKE Service Networking Skill

This skill provides workflows for exposing applications running on GKE securely to the internet or internal networks.

Deployable manifest templates live in assets/ — edit the # Replace ... placeholders before applying.

Workflows

1. Configure Gateway API (Recommended)

The Gateway API is the modern way to manage routing in Kubernetes.

Prerequisites: Gateway API must be enabled on the cluster (enabled by default on new clusters running GKE 1.26+; on older supported versions enable it with --gateway-api=standard).

Templates:

  • assets/gateway.yaml — external Gateway using the gke-l7-global-external-managed GatewayClass with an HTTP listener.
  • assets/httproute.yaml — HTTPRoute attaching to the Gateway via parentRefs and routing a path prefix to a Service backendRef.
  • assets/httproute-traffic-split.yaml — HTTPRoute demonstrating weighted traffic splitting (e.g. 90/10) for canary deployments across backend services.
kubectl apply -f assets/gateway.yaml
kubectl apply -f assets/httproute.yaml

Traffic Splitting (Canary Deployments):

HTTPRoute supports weighted traffic splitting across multiple backend Services for canary rollouts:

spec:
  rules:
    - backendRefs:
        - name: app-v1
          port: 80
          weight: 90
        - name: app-v2
          port: 80
          weight: 10

2. Configure Standard GKE Ingress

Use standard Ingress for simpler use cases or legacy setups.

Template: assets/ingress.yaml — GCE Ingress (kubernetes.io/ingress.class: "gce" annotation) routing to a Service.

3. Secure with Cloud Armor

Cloud Armor provides WAF and DDoS protection.

  1. Create a Security Policy in Cloud Armor:

    gcloud compute security-policies create {security_policy_name} \
      --description "WAF policy for {app_name}"
    
    # Example rule: block an abusive IP range
    gcloud compute security-policies rules create 1000 \
      --security-policy {security_policy_name} \
      --action deny-403 \
      --src-ip-ranges "203.0.113.0/24" \
      --description "Block abusive range"
    
  2. Reference it in a BackendConfig: assets/backendconfig.yaml (sets spec.securityPolicy.name).

  3. Associate the BackendConfig with your Service via annotations:

    # In your Kubernetes Service manifest metadata.annotations:
    cloud.google.com/backend-config: '{"default": "{backend_config_name}"}'
    # Or for specific port mappings:
    cloud.google.com/backend-config: '{"ports": {"80": "{backend_config_name}"}}'
    

4. Configure Google-Managed SSL Certificates

Automatically provision and renew SSL certificates.

Legacy Ingress approach: apply assets/managed-certificate.yaml (a ManagedCertificate listing your domains), then reference it in the Ingress annotations:

networking.gke.io/managed-certificates: {certificate_name}

Gateway API approach: for standard Certificate Manager integration, create a CertificateMap and reference it in the Gateway metadata annotations using the exact annotation networking.gke.io/certmap (spelled without any hyphens in certmap):

metadata:
  annotations:
    networking.gke.io/certmap: {certificate_map_name}

[!IMPORTANT] The annotation key is strictly networking.gke.io/certmap (do not use cert-map or certificate-map).

Alternatively, reference a Kubernetes Secret in the HTTPS listener's tls.certificateRefs. Both variants are in assets/gateway-https.yaml.

5. Enable Container-Native Load Balancing (Recommended)

Container-native load balancing allows load balancers to target Kubernetes Pods directly, rather than targeting nodes. This improves latency and distribution.

Prerequisites: Cluster must be VPC-native.

How it works: the cloud.google.com/neg annotation on a Service triggers creation of a NEG that mirrors the Pod IPs. GKE often adds it for you — but not always, and knowing which case you are in is the whole point.

# In your Kubernetes Service manifest metadata.annotations:
cloud.google.com/neg: '{"ingress": true}'

When the annotation is automatic (do not add it by hand):

  • Internal Ingress — container-native load balancing is always used, not optional. Internal Ingress always uses GCE_VM_IP_PORT NEGs and requires a VPC-native cluster.
  • External Ingress, but only when all four hold: the cluster is VPC-native, is not on Shared VPC, does not use GKE Network Policy, and has the HttpLoadBalancing add-on enabled (on by default — do not disable it). GKE then annotates Services automatically.

When you must add it explicitly:

  • Standalone NEGs — you manage the load balancer yourself instead of letting Ingress own it. Required if the LB must be configured outside GKE, since Ingress overwrites managed load balancer settings on sync or upgrade. You become responsible for every part of the load balancer.
  • Any external-Ingress cluster failing one of the four conditions above — Shared VPC, GKE Network Policy, or non-VPC-native. Enable per Service.
  • Legacy configurations — some older external Ingress objects created on VPC-native clusters still use instance group backends.

Not supported / no NEG fallback:

  • Windows Server node pools.
  • Routes-based (non-VPC-native) clusters with external Ingress — the Ingress controller falls back to unmanaged instance groups spanning all nodes.

Scale consequence: without NEGs a cluster is capped at 1,000 nodes, and non-NEG Services behind Ingress stop functioning correctly beyond that. With NEGs there is no GKE node limit.

6. Configure Private Service Connect (PSC)

Private Service Connect allows you to expose services in one VPC to consumers in another VPC securely, without VPC peering.

Prerequisite: The backing Service must be an internal passthrough Network Load Balancer — i.e. type: LoadBalancer with the networking.gke.io/load-balancer-type: "Internal" annotation. The ServiceAttachment requires this; a ClusterIP or external LoadBalancer Service will not work.

Steps:

  1. Create an internal LoadBalancer Service for your workload.
  2. Create a ServiceAttachment referencing that Service: assets/service-attachment.yaml (sets connectionPreference, the PSC NAT subnet, and the Service resourceRef).
  3. Share the ServiceAttachment URI with consumers to create a PSC endpoint in their VPC.

7. Topology Aware Routing (Cost & Latency Optimization)

To minimize cross-zone data transfer costs and network latency, configure Kubernetes Services with Topology Aware Routing. This routes traffic to Pods in the same zone as the originating client:

# In your Kubernetes Service manifest metadata.annotations:
service.kubernetes.io/topology-mode: auto

Gotchas

  1. Certificate Manager API must be enabled for the networking.gke.io/certmap annotation to work (gcloud services enable certificatemanager.googleapis.com); without it the Gateway fails to provision the certificate map.
  2. Regional Gateway classes need a proxy-only subnet: classes like gke-l7-regional-external-managed and gke-l7-rilb require a subnet with --purpose=REGIONAL_MANAGED_PROXY in the region; the Gateway stays unprogrammed without it.
  3. ManagedCertificate provisioning depends on DNS: the certificate stays in Provisioning until the domain's A/AAAA records point at the load balancer IP, and can take 15-60 minutes after DNS is correct.

Version History

  • d08678b Current 2026-08-27 13:32

Same Skill Collection

plugins/cloud/gemini-api/skills/gemini-api/SKILL.md
plugins/cloud/gemini-api/skills/gemini-interactions-api/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-endpoint-management/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-migrate-from-ai-studio/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-model-registry/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-prompt-management/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-rag-engine-management/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-skill-registry/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-troubleshooting/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-tuning-management/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/agent-platform-tuning/SKILL.md
plugins/cloud/gemini-enterprise-agent-platform/skills/gemini-agents-api/SKILL.md
plugins/cloud/google-cloud-core/skills/gcloud/SKILL.md
plugins/cloud/google-cloud-core/skills/google-cloud-recipe-auth/SKILL.md
plugins/cloud/google-cloud-core/skills/google-cloud-recipe-onboarding/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-ai-troubleshooting-jobset-interruption/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-ai-troubleshooting-tpu-dynamic-slices-monitoring/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-ai-troubleshooting-tpu-metrics-monitoring/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-batch-hpc/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-cluster-autoscaler/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-compute-classes/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-cost-optimization/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-inference/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-multitenancy/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-workload-scaling/SKILL.md
plugins/cloud/google-cloud-gke-workloads/skills/gke-workload-troubleshooting/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-app-onboarding/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-backup-dr/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-basics/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-cluster-creation/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-golden-path/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-networking/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-observability/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-reliability/SKILL.md
plugins/cloud/google-cloud-gke/skills/gke-storage/SKILL.md
plugins/cloud/google-cloud-run/skills/cloud-run-basics/SKILL.md
plugins/cloud/google-cloud-well-architected/skills/google-cloud-waf-cost-optimization/SKILL.md
plugins/cloud/google-cloud-well-architected/skills/google-cloud-waf-operational-excellence/SKILL.md
plugins/cloud/google-cloud-well-architected/skills/google-cloud-waf-performance-optimization/SKILL.md
plugins/cloud/google-cloud-well-architected/skills/google-cloud-waf-reliability/SKILL.md
plugins/cloud/google-cloud-well-architected/skills/google-cloud-waf-security/SKILL.md
plugins/cloud/google-cloud-well-architected/skills/google-cloud-waf-sustainability/SKILL.md
skills/ads/data-manager-api-audience-ingestion/SKILL.md
skills/ads/data-manager-api-event-ingestion/SKILL.md
skills/ads/data-manager-api-setup/SKILL.md
skills/ads/data-manager-api/data-manager-api-audience-ingestion/SKILL.md
skills/ads/data-manager-api/data-manager-api-event-ingestion/SKILL.md
skills/ads/data-manager-api/data-manager-api-setup/SKILL.md
skills/ads/google-ads-api-mcp-setup/SKILL.md

Metadata

Files
0
Version
d08678b
Hash
faa379de
Indexed
2026-08-27 13:32

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-28 01:08
浙ICP备14020137号-1 $Map of visitor$