<p>In K8S we have liveness and readiness. Both are running through full app lifecycle. But this is not enough for me. I would like to run some health check but only on start, or configure readiness to run only on start. Is it possible?</p>

Piotr Stapp
<p>Take a look at <a href="https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/" rel="nofollow noreferrer">handler lifecycle events</a>, depending on the kind of health check probe you are doing the handler event will vary. I tried this on a simple "hello-world" pod. Set up a command in your <code>postStart</code> event, and this will run only once, when the container is built and running. My example yaml file looks like this:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world
  labels:
    app: hello-world
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello-world
  template:
    metadata:
      labels:
        app: hello-world
    spec:
      containers:
      - image: paulbouwer/hello-kubernetes:1.5
        lifecycle:
          postStart:
            exec:
              command: ["/bin/sh", "-c", "echo Hello from the postStart handler &gt; /usr/share/message"]
        name: hello-world
        ports:
        - containerPort: 8080
          name: http
</code></pre>
