<p>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.</p>
<p>Any advice on how to set this condition on a busybox container please?</p>
<p>Thanks for helping out a beginner.</p>
<p>Sincerely.
V</p>

vikingz
<p><code>[[ ! -z &quot;$YOURVAR&quot; ]]</code> will return false if $YOURVAR is not defined.</p>
<pre><code>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 &quot;$var&quot; ]]
      initialDelaySeconds: 5
      periodSeconds: 5
</code></pre>
