Reputation: 11
I'm trying to figure this problem out where i need to Attach liveness probe to the container and restart after checking if environment USER is null or undefined.
Any advice on how to set this condition on a busybox container please?
Thanks for helping out a beginner.
Sincerely. V
Upvotes: 1
Views: 2671
Reputation: 3244
[[ ! -z "$YOURVAR" ]]
will return false if $YOURVAR is not defined.
apiVersion: v1
kind: Pod
metadata:
labels:
test: liveness
name: liveness-exec
spec:
containers:
- name: liveness
image: k8s.gcr.io/busybox
args:
- /bin/sh
- -c
- touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600
livenessProbe:
exec:
command:
- /bin/bash
- [[ ! -z "$var" ]]
initialDelaySeconds: 5
periodSeconds: 5
Upvotes: 1