Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 476
wti Avatar asked Oct 25 '25 10:10

wti


1 Answers

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

like image 62
gohm'c Avatar answered Oct 28 '25 03:10

gohm'c