0

I have 2 pods - P1 & P2.

  • P1 is running Nginx Proxy.
  • P2 running an envoy + custom application.

Due to some issue, the application stop responding to the requests redirected from P1.

But locally K8s probes are working fine in P2.
In this condition, Is it possible to restart the P2 based on the Error count seen in P1? (No service mash used in this setup).

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
Midson
  • 1,018
  • 3
  • 12
  • 23
  • `But locally K8s probes are working fine` - fix your probes first. Then let k8s do its job – rkosegi Sep 16 '21 at 10:19
  • Thanks. App fixing might take sometime. So trying for a workaround. How to handle, if the issue is related to network connection or external to application? – Midson Sep 16 '21 at 10:32

1 Answers1

1

In this condition, Is it possible to restart the P2 based on the Error count seen in P1? (No service mash used in this setup).

You have several ways to accomplish that but they are a bit of "hack"

CronJob

Add CronJob which checks if the pod is responding and if not restart it

kubectl get events

Write your custom "Event Handler" to grab the stop events from the K8S events kubectl get events. you can fine-tune the events with --field-selector for example.

enter image description here

CodeWizard
  • 128,036
  • 21
  • 144
  • 167