Home > Software design >  Configure a LivenessProbe which simply runs true question; preparation to pass the CKA exams
Configure a LivenessProbe which simply runs true question; preparation to pass the CKA exams

Time:07-05

I was passing one of the sample tests for CKA and one question says this:

"Configure a LivenessProbe which simply runs true"

This is while creating simple nginx pod(s) in the general question, then they ask that as one of the items. What does that mean and how to do it?

CodePudding user response:

...Configure a LivenessProbe which simply runs true...while creating simple nginx pod...

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - image: nginx:alpine
    name: nginx
    ports:
    - containerPort: 80
    livenessProbe:
      exec:
        command: ["true"]

true is a command that returns zero. In this case it means the probe simply return no error. Alternately, you can probe nginx with: command: ["ash","-c","nc -z localhost 80"].

  • Related