<p>I have two pods, after the first pod has rebooted, the other should automatically reboot after it. Pods are created using different deployments</p>

<p>You can write down the script in python or any language which will look for the event for <strong>POD</strong> or <strong>deployment</strong> as soon as one gets restarted your script will <strong>roll out</strong> the deployment this way for the second deployment PODs will be <strong>restarted</strong>.</p>
<p>You can run the script inside one POD or as deployment which will continuously monitor the <strong>Deployment-1</strong> and restart the <strong>deployment-2</strong> if any changes occurred in <strong>deployment-1</strong>.</p>
<p>Example python client</p>
<pre><code>import logging
import time
from kubernetes import client, config, watch
import json
import requests
import time
logger = logging.getLogger('k8s_events')
logger.setLevel(logging.DEBUG)

# If running inside pod
config.load_incluster_config()

# If running locally
#config.load_kube_config()

v1 = client.CoreV1Api()
v1ext = client.ExtensionsV1beta1Api() 

w = watch.Watch()

mydict={}

webhook_url = '';

while True:
    pod_list= v1.list_namespaced_pod(&quot;default&quot;);
</code></pre>
<p>further, you can write the logic for checking the <strong>restart</strong> count.</p>
<p><a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/</a></p>
<p>List of official libraries : <a href="https://kubernetes.io/docs/reference/using-api/client-libraries/#officially-supported-kubernetes-client-libraries" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/using-api/client-libraries/#officially-supported-kubernetes-client-libraries</a></p>
