title: Microk8s kubernetes preStop httpGet does not work
body: <p>The livenessProbe works, but the lifecycle preStop does not.</p>
  <p>My yaml:</p>
  <pre><code>- image: localhost:32000/worker:2022-08-28-h
    name: worker-container 
    ports:
      - containerPort: 55001
        name:  name-b
    livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
          initialDelaySeconds: 60
          periodSeconds: 15
          failureThreshold: 3
          timeoutSeconds: 10
    lifecycle:
      preStop:
        httpGet:
          path: /prestop
          port: 8080
  </code></pre>
  <p>The pod:</p>
  <pre><code>const express = require('express');
  const app = express();
  
  app.get('/prestop', (req, res) =&gt; {
      console.log(&quot;rx prestop&quot;)
      .....
      res.send(&quot;prestop passed&quot;);
  });
  
  app.get('/healthz', (req, res) =&gt; {
      console.log(&quot;health check rx&quot;)
      .....
      res.send(&quot;Health check passed&quot;);
  });
  </code></pre>
  <p>When I apply my yaml file, I see the health probe working as expected with logs
  &quot;health check rx&quot; and &quot;Health check passed&quot;.</p>
  <p>When I change the code in &quot;....&quot; to return</p>
  <pre><code>res.status(500).send('Health check did not pass')
  </code></pre>
  <p>I see microk8s kubectl restart my module after 3 failed probes.
  I was expecting the restart of the container to trigger lifecycle preStop but it
  does not.</p>
  <p>Am I correct in assuming a container restart because of failed liveness problems will trigger the preStop event? The documentation I could find is not explicit about this.</p>
  <pre><code>microk8s kubectl delete -f k8s/production/transcribe-worker.yaml
  </code></pre>
  <p>Also does not trigger the preStop event.</p>
  <p>So I suspect I do not understand how preStop works.
  Maybe a limitation of microk8s?
  Help would be appreciated.</p>