<p>I have a TCP service. I created a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-tcp-liveness-probe" rel="nofollow noreferrer">TCP readiness probe</a> for my service which appears to be working just fine.</p>
<p>Unfortunately, my EC2 target group wants to perform an HTTP health check on my instance. My service doesn't respond to HTTP requests, so my target group is considering my instance unhealthy.</p>
<p>Is there a way to change my target group's health check from &quot;does it return an HTTP success response?&quot; to &quot;can a TCP socket be opened to it?&quot;</p>
<p>(I'm also open to other ways of solving the problem if what I suggested above isn't possible or doesn't make sense.)</p>

Jason Swett
<p>TCP is a valid protocol for health checks in 2 cases:</p>
<ol>
<li>the classic flavor of the ELB, <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-healthchecks.html#health-check-configuration" rel="nofollow noreferrer">see docs</a></li>
<li>The network load balancer, <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-health-checks.html#health-check-settings" rel="nofollow noreferrer">see docs</a></li>
</ol>
<p>in case you're stuck with the Application Load Balancer - the only idea that comes to mind is to add a sidecar container that will respond to HTTP/HTTPS based on your TCP status. You could easily do this with nginx, although it would probably be quite an overkill.</p>
