<p>I'm not sure if this is considered to be a best practice, but for ease of management I have created a Deployment that consists of 2 containers (Api Event server and Api server). Api server can send events that need to be processed by Api Event server and returned back. It is easier for me to manage these on in one pod to allow localhost access between them and not worry about defining <code>ClusterIP</code> services for all my environments.</p>

<p>One of my concerns is that if say Api Event server exits with error, pod will still be active as Api server continues to run. Is there a way to tell kubernetes to terminate a pod if one of it's containers fails?</p>

<p>Here is my deployment, here only port 8080 is exposed to the public via LoadBalancer service. Perhaps I can somehow add liveliness and readiness probe to both of these?</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: development-api
spec:
  replicas: 2
  selector:
    matchLabels:
      app: development-api
  template:
    metadata:
      labels:
        app: development-api
    spec:
      containers:
        - name: development-api-server
          image: &lt;my-server-image&gt;
          ports:
            - containerPort: 8080
              protocol: TCP
        - name: development-events-server
          image: &lt;my-events-image&gt;
          ports:
            - containerPort: 3000
              protocol: TCP
</code></pre>

<p>Use liveness and readiness probes. 
<a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/</a></p>

<p>In your case </p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: development-api
spec:
  replicas: 2
  selector:
    matchLabels:
      app: development-api
  template:
    metadata:
      labels:
        app: development-api
    spec:
      containers:
        - name: development-api-server
          image: &lt;my-server-image&gt;
          ports:
            - containerPort: 8080
              protocol: TCP
          livenessProbe:
            tcpSocket:
              port: 8080
        - name: development-events-server
          image: &lt;my-events-image&gt;
          ports:
            - containerPort: 3000
              protocol: TCP
          livenessProbe:
            tcpSocket:
              port: 3000
</code></pre>
