<p>For self-healing I want to be able to call a function on a specific pod instance from outside the kube cluster. </p>

<p>So... I have 2 networks, non-kube, and my kube-cluster. My kube-cluster contains one service, myapp and has 8 replicas spread across 4 nodes. If each of these pods was given a VIP 10.1.1.x where x is from 1 to 8, I want to be able to from any app running in non-kube, be able to call any of the API methods exposed in myapp, but forcing a particular replica. </p>

<p>E.g. myapp has one REST GET method, </p>

<pre><code>whatismyvip()
</code></pre>

<p>And from a console app running in non-kube I want to be able to ensure I get the following output, by calling the above method on the right pod. </p>

<pre><code>10.1.1.4
10.1.1.6
10.1.1.8
10.1.1.2
10.1.1.5
</code></pre>

<p>Why would I want to do something like this? Well, generally the errors that are generated in the kube-cluster service are server errors due to bad data / configuration, rather than the system "going down", i.e. 500 errors, and so I want the client to be smart enough to go </p>

<p>"ok, i got an error from 10.1.1.2, i will try 10.1.1.3"</p>

<p>I'd prefer to do this natively in kubernetes (even if it means custom IngressController) rather than sidecar service mesh, Envoys et al. </p>

<p>Create a loadbalanced service that fronts your replicaset of 8 pods. Define a liveness HTTP probe that pings the <code>whatismyvip()</code> HTTP endpoint.</p>

<p>The host kubelet will restart the pod if you get any unexpected HTTP status codes.</p>

<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-http-request" rel="nofollow noreferrer">define a liveness HTTP request</a></p>

<p>Otherwise if what you mean by forcing a particular replica is that you wish to direct your request into a specific pod from outside the cluster, then perhaps a custom solution might be better. Each see if 2 X pods on each node might have a clusterIP service fronting them. Then use a loadbalanced service fronting a custom app that proxies your request for a specific replica or set of pods based on your request.</p>

<p>E.g. a URL query string parameter that targets clusterIP service A, B, C, or D.</p>

<p><code>https://customrouterapp/whatismyvip?replicaset=B</code></p>
