<p>I am new to the Kubernetes. I would like to setup liveness for my EKS kubernetest cluster. I went through the documentation below
<a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/</a>
I have few questions to setup the above</p>

<ol>
<li>When I apply liveness-exec do I need mention any particular namespace for example
<code>kubectl apply -f https://k8s.io/examples/pods/probe/exec-liveness.yaml -n kube-system</code></li>
<li>Can I use yaml file directly from k8s.io/example or I need to clone in my local</li>
<li><p>How these whole things works? What I understand so far is </p>

<p>a) When we deploy the pod, it will create a container and create /tmp/healthy file and then delete the container</p>

<p>b) It will run after 30 seconds and redo the same thing from step 3a</p></li>
</ol>

<p>I followed above steps and I am getting an error saying 
cat:</p>

<pre><code>can't open '/tmp/healthy': No such file or directory
</code></pre>

<p>This post may sound repetitive but I tried going through the previous post but unable to find the solutions. Please help</p>

Mohan
<blockquote>
  <p>1) When I apply liveness-exec do I need mention any particular namespace
  for example kubectl apply -f
  <a href="https://k8s.io/examples/pods/probe/exec-liveness.yaml" rel="nofollow noreferrer">https://k8s.io/examples/pods/probe/exec-liveness.yaml</a> -n kube-system</p>
</blockquote>

<p>If you specify a namespace in the apply command the pod will be created in that namespace, provided the namespace exist. If you don't specify a namespace (by command line or in the pod yaml definition) then the pod will be created in the default namespace</p>

<blockquote>
  <p>2) Can I use yaml file directly from k8s.io/example or I need to clone
  in my local</p>
</blockquote>

<p>You can apply it direcly from k8s.io/example. </p>

<pre><code>kubectl apply -f https://k8s.io/examples/pods/probe/exec-liveness.yaml
</code></pre>

<blockquote>
  <p>3) How these whole things works? What I understand so far is</p>
  
  <p>a) When we deploy the pod, it will create a container and create
  /tmp/healthy file and then delete the container</p>
  
  <p>b) It will run after 30 seconds and redo the same thing from step 3a</p>
</blockquote>

<p>I think that the idea of the example is just to show how liveness probes work and how your pod will be restarted after the test fails, so the commands executed are a bit artificial. I think the error you see is simply the probe failing the check "cat /tmp/healthy"</p>
