Kubernetes external probes

9/17/2019

Is it possible to define external path for example a other webserver as path for the web probes? Or a TCP probe with a different IP?

        livenessProbe:
          httpGet:
            path: external.de/test
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 10

I know thats not how you should use probes but I need it for testing. Does someone know how to define probes that are not applied on the pods directly?

-- djkobi97
kubernetes

2 Answers

9/20/2019

You can use following command along with your liveness probe

livenessProbe:
  exec:
    command:
    - curl
    - external.de/test:8080
  initialDelaySeconds: 10
  periodSeconds: 105

In this case, if curl external.de/test:8080command returns with an exit code of 0 then it will be assumed healthy, otherwise any other exit code will be deemed unhealthy.

Also keep in mind, once probe will fail, the pod running this probe will be restarted, not the one that running external.de/test:8080 web server

More details on how to use command within liveness probe described here

-- A_Suh
Source: StackOverflow

9/17/2019

If you want to achieve that, you cannot use the http probe.

You have to use the exec one, pointing to a simple bash script that executes cURL on your behalf, so you can mount it via a ConfigMap or directly hostMount to perform your testing.

-- prometherion
Source: StackOverflow