<p>i have tried the following commands to check the zookeeper health and its corresponding error i am getting</p>
<ol>
<li>sh -c zookeeper-ready 2181 (error: zookeeper-ready command not found)</li>
<li>i have tried all echo commands (error: it is not a file)</li>
<li>/apache-zookeeper-3.5.5-bin/bin/zkServer.sh start (error: cannot be able to start)</li>
<li>/apache-zookeeper-3.5.5-bin/bin/zkServer.sh stop (error: zookeeper stopping ...... there is no zookeeper to stop)</li>
<li>/apache-zookeeper-3.5.5-bin/bin/zkServer.sh status (error: when i am stopping the zookeeper the probe needs to fail for this command but it is not happening. it needs to be done)</li>
</ol>
<p>and i have used these commands in go file as</p>
<pre><code>    LivenessProbe: &amp;corev1.Probe{
        Handler: corev1.Handler{
            Exec: &amp;corev1.ExecAction{
                Command: []string{&quot;sh&quot;,
                    &quot;/apache-zookeeper-3.5.5-bin/bin/zkServer.sh&quot; ,
                    &quot;status&quot;,
                },
            },
        },
        InitialDelaySeconds: 30,
        TimeoutSeconds:      5,
    },
    ReadinessProbe: &amp;corev1.Probe{
        Handler: corev1.Handler{
            Exec: &amp;corev1.ExecAction{
                Command: []string{
                    &quot;sh&quot;,
                    &quot;/apache-zookeeper-3.5.5-bin/bin/zkServer.sh&quot; ,
                    &quot;status&quot;,
                },
            },
        },
        InitialDelaySeconds: 30,
        TimeoutSeconds:      5,
    },
</code></pre>

mokshagna sai teja
<p>To check liveness and rediness for zookeeper you can use following command</p>
<p><code>echo &quot;ruok&quot; | timeout 2 nc -w 2 localhost 2181 | grep imok</code></p>
<p>but make sure to set the env variable <code>ZOO_4LW_COMMANDS_WHITELIST=ruok</code> other wise the the check will fail.</p>
