<p>I'm learning microservice with docker and k8s.
This project is a simple node.js express app and I tried to add a reverse proxy in it.
I already pushed the image (both the express app as well as the reverse proxy) to my docker hub.</p>
<p>Now I encounter a problem when I tried to access an endpoint in my pods.
My pod is running, and when I tried the endpoint:</p>
<p>curl:curl http://my-app-2-svc:8080/api/health</p>
<p>I get connection refused, I'm wondering what' wrong with that?</p>
<p>It seems that there are some problem with the liveness probe..
When I describe the pods: it shows:</p>
<p><strong>Liveness probe failed: Get &quot;http://192.168.55.232:8080/health&quot;: dial tcp 192.168.55.232:8080: connect: connection refused</strong></p>
<p><a href="https://i.stack.imgur.com/3qsAU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3qsAU.jpg" alt="enter image description here" /></a></p>
<p>Here is my github link for this project: <a href="https://github.com/floatingstarlight/Microservice" rel="nofollow noreferrer">https://github.com/floatingstarlight/Microservice</a></p>
<p>Can anyone helps me with that? Thanks!</p>

mundanus1130
<pre><code>...
livenessProbe:
  httpGet:
    path: /health
    port: 8080
...
</code></pre>
<p>If you asked for liveness probe, you need to implement it or your pod will be seen as a failure and restart every now and then. You can update your <a href="https://github.com/floatingstarlight/Microservice/blob/main/server.js" rel="nofollow noreferrer">server.js</a> to the minimum as follow to get up and running:</p>
<pre><code>const express = require('express')
const app = express()
const port = 8080

app.get('/health', (req, res) =&gt; {
  res.send('ok')
})

app.listen(port, () =&gt; {
  console.log(`Listening on port ${port}`)
})
</code></pre>
