wti
wti

Reputation: 484

Configure a LivenessProbe which simply runs true question; preparation to pass the CKA exams

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?

Upvotes: 4

Views: 2736

Answers (1)

gohm'c
gohm'c

Reputation: 15568

...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"].

Upvotes: 5

Related Questions