Home / Market / gke unprotected statefulset

gke unprotected statefulset

Audits, detects, and proposes fixes for GKE StatefulSets that lack a matching PodDisruptionBudget (PDB) to prevent simultaneous Pod evictions during voluntary node drains (GKE insight subtype PDB_UNPROTECTED_STATEFULSET). Use when investigating the PDB_UNPROTECTED_STATEFULSET insight, checking whether GKE StatefulSets have a matching PDB, or proposing fixes for selector mismatches where an existing PDB does not match the StatefulSet's .spec.selector. Don't use for existing PDBs that allow zero d

skill★ 255700 dlgithubApache-2.0Install in CosmosUpstream Source

Documentation & Preview

--- name: gke-unprotected-statefulset metadata: version: "1.0.0" category: Containers description: >- Audits, detects, and proposes fixes for GKE StatefulSets that lack a matching PodDisruptionBudget (PDB) to prevent simultaneous Pod evictions during voluntary node drains (GKE insight subtype PDB_UNPROTECTED_STATEFULSET). Use when investigating the PDB_UNPROTECTED_STATEFULSET insight, checking whether GKE StatefulSets have a matching PDB, or proposing fixes for selector mismatches where an existing PDB does not match the StatefulSet's .spec.selector. Don't use for existing PDBs that allow zero disruptions or block node drains (PDB_UNPERMISSIVE), general probe and PDB setup unrelated to this insight (use gke-reliability), upgrade planning (use gke-upgrades), Pods stuck in Pending (use gke-workload-troubleshooting), node autoscaling or capacity stockouts (use gke-cluster-autoscaler), ComputeClass configuration (use gke-compute-classes), or general Kubernetes manifest generation (use gke-manifest-generation).

---

GKE unprotected StatefulSet skill

Use this skill to find, verify, and propose fixes for GKE StatefulSet workloads lacking a matching PodDisruptionBudget (PDB), subtype PDB_UNPROTECTED_STATEFULSET. Without a matching PDB, voluntary node drains can take down all Pods at once or drop a stateful app below quorum; a zero-budget PDB triggers PDB_UNPERMISSIVE, which GKE violates after one hour (see When GKE identifies workloads with vulnerability to disruption and "Dealing with disruptions" and "Pod disruption budgets" in Disruptions).

> Read-only rule: Run read-only diagnostic commands only. Never drain, > delete, or re-create nodes, create or modify Kubernetes resources, dismiss or > change insight or recommendation state, or run any other command that changes > the cluster or project. Give the user any fix to apply themselves.

Usage attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, read and follow Usage Attribution.

Prerequisites

  1. Google Cloud CLI, APIs, and billing: If gcloud is missing or

uninitialized or container.googleapis.com is disabled, point the user to Before you begin (never enable APIs or install software yourself). If recommender.googleapis.com is disabled, point the user to "gcloud" in Enable the API. The project needs an active Cloud Billing account.

  1. kubectl and cluster credentials: If kubectl or required auth plugins

are missing, point the user to "Install kubectl" and "Install required plugins" in Install kubectl and configure cluster access, and use "Store cluster information for kubectl" on that page to configure cluster credentials for kubectl.

  1. IAM roles: Under

Google Kubernetes Engine roles and Required roles:

credentials and read clusters, StatefulSets, PDBs, insights, and recommendations.

user to create/update PDBs, update/scale StatefulSets, or dismiss recommendations.

for the user to configure cluster maintenance windows/exclusions or Standard node-pool maintenance exclusions.

  1. Documentation:

(Sections: "Identify workloads with vulnerability to disruption", "When GKE identifies workloads with vulnerability to disruption", "Implement the guidance to improve disruption readiness")

(Sections: "Before you begin", "Required roles", "View insights and recommendations", "Dismiss or restore recommendations", "Dismiss recommendations using the Google Cloud CLI")

(Sections: "gcloud")

(Sections: "Description", "Content", "Target Resources", "State Info", "Severity", "Last Refresh Time")

(Sections: "Google Kubernetes Engine roles")

(Sections: "Install kubectl", "Install required plugins", "Store cluster information for kubectl")

(Sections: "View your clusters")

(Sections: "Creating a StatefulSet", "Inspecting a StatefulSet", "Updating a StatefulSet", "Scaling a StatefulSet")

(Sections: "maxSurge: GKE creates a new surge node before removing an existing one", "maxUnavailable: GKE makes an existing node unavailable to recreate it", "Phase 3: Drain blue pool", "Phase 5: Delete blue pool")

(Sections: "Automatic node upgrades")

(Sections: "Troubleshoot node pool upgrades taking longer than usual")

(Sections: "Automatic maintenance that doesn't respect GKE maintenance policies", "Maintenance windows", "Maintenance exclusions", "Node pool maintenance exclusions", "Limitations on configuring maintenance exclusions", "Example: Company's legacy database not resilient to node pool upgrades")

(Sections: "Configure a maintenance window", "Configure a maintenance exclusion")

(Sections: "Environment's cluster")

(Sections: "Before you contact support", "Recommendations for efficient support")

(Sections: "Voluntary and involuntary disruptions", "Dealing with disruptions", "Pod disruption budgets")

(Sections: "Identify an Application to Protect", "Think about how your application reacts to disruptions", "Rounding logic when specifying percentages", "Specifying a PodDisruptionBudget", "Create the PDB object", "Check the status of the PDB", "Healthiness of a Pod", "Unhealthy Pod Eviction Policy", "Arbitrary workloads and arbitrary selectors")

(Sections: "Define readiness probes")

This skill creates no billable resources, so no teardown is required.

Diagnostic workflow

> Scope and Managed Airflow check: > * Managed Service for Apache Airflow (formerly Cloud Composer): Under > Environment's cluster, > clusters for Managed Airflow and workloads deployed into them are managed > by Google: do not introduce changes in the environment's cluster (doing so > might break the environment). When the user says the cluster belongs to a > Managed Airflow (or Cloud Composer) environment, do not propose workload > or PDB changes; ask when that isn't clear. > * Unpermissive PDBs (PDB_UNPERMISSIVE): For requests solely about > PDB_UNPERMISSIVE or drains blocked by > "Cannot evict pod as it would violate the pod's disruption budget." on a > matching PDB, stop and point the user to > When GKE identifies workloads with vulnerability to disruption > and > Troubleshoot node pool upgrades taking longer than usual > to adjust minAvailable or maxUnavailable themselves. In an audit, > handle matching unpermissive PDBs via "When a matching PDB already > exists". > * Other GKE topics: Hand off general probe/PDB setup to > gke-reliability, upgrade planning to gke-upgrades, Pending Pods to > gke-workload-troubleshooting, autoscaling/stockouts to > gke-cluster-autoscaler, ComputeClasses to gke-compute-classes, and > general manifest generation to gke-manifest-generation. > * Provided manifests, insights, or kubectl output: After the Managed > Airflow check, if insight/recommendation details, manifests, or kubectl > output are provided, capture any {project_id}, {cluster_name}, and > {location}, skip Steps 1–2 (honoring dismissed recommendations per Step > 2), and evaluate every workload in Step 3 without discovery commands.

Step 1: Identify the target cluster

Obtain {project_id}, {cluster_name}, and {location} (control plane region or zone) from the prompt. If {project_id} is unknown, ask the user; if {cluster_name} or {location} is unknown, ask the user or follow View your clusters for {project_id}. Ask when it isn't clear whether {cluster_name} belongs to a Managed Airflow environment.

Step 2: Check for PDB_UNPROTECTED_STATEFULSET insights and recommendations

  1. Query insights: Under

Identify workloads with vulnerability to disruption, disruption-readiness insights are available only via gcloud or the Recommender API (not the Google Cloud console). Follow gcloud or API instructions in [View insights and recommendations](https://docs.cloud.google.com/kubernetes-engine/d