Twelve Pods Restart Together
Twelve pods serve this Go API. The handler below is wired to the Kubernetes liveness probe: httpGet on /healthz, periodSeconds: 5, failureThreshold: 2. Most endpoints on this service never query the database.
func healthz(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(r.Context(), 2*time.Second)
defer cancel()
if err := db.PingContext(ctx); err != nil { // the shared primary
http.Error(w, "db down", http.StatusServiceUnavailable)
return
}
if err := recommender.Ping(ctx); err != nil { // optional page module
http.Error(w, "recommender down", http.StatusServiceUnavailable)
return
}
w.WriteHeader(http.StatusOK)
}
The shared primary stalls for 20 seconds. What happens, and what is the smallest correct fix?
Sign in to answer questions and track your progress
Sign In