Gaurav Darji
Gaurav Darji

Reputation: 1

How to Prevent PostgreSQL Pod Restart on GKE Node Autoscaling?

I'm running a Kubernetes cluster on GKE with autoscaling enabled. My workloads are running fine, but I have an issue with my PostgreSQL database, which is deployed as a StatefulSet with a single replica.

The Problem:

Whenever GKE adds a new node, my PostgreSQL pod restarts due to rescheduling. Since it has a high data volume, the restart process takes a long time, affecting application performance.

Using PodDisruptionBudgets (PDB), but since I have only one replica, it doesn't fully prevent eviction.

Setting node affinity, but this limits autoscaling flexibility.

Checking for persistent volume stability, but my storage remains intact.

How can I prevent my PostgreSQL pod from restarting when GKE autoscaling adds nodes?

Are there any Kubernetes-native mechanisms to handle this better?

What are the best practices for managing stateful workloads with autoscaling?

Would appreciate any insights from the community!

Upvotes: 0

Views: 14

Answers (0)

Related Questions