<p>I need to run a command in clickhouse database in kubernetes.</p>
<p>When I try it with docker it works ok:</p>
<p><code>docker run -it yandex/clickhouse-client -h 172.19.0.1  --database=test --query=&quot;SYSTEM RELOAD DICTIONARIES&quot;</code></p>
<p>but when I run it in kub:</p>
<pre><code>kubectl run  --quiet -it --rm  clickhouse-client --image=yandex/clickhouse-client -- -h clickhouse-server  --database=test --query=&quot;SYSTEM RELOAD DICTIONARIES&quot;
</code></pre>
<p>Second command hangs.
The pod is in CrashLoopBackOff with Back-off restarting failed container/
And the logs of container contains the result of query.</p>
<p>Why do the result not flushed to tty?</p>
<p>This command works for me:</p>
<p><code>kubectl run busybox --quiet -it --rm --restart=Never --image=busybox -- nslookup foobar</code></p>
<p>What is the difference with click-house client?</p>

<p>@ogbofjnr this is likely because the pod is getting killed as soon as your query is done. Kubernetes will restart the pod, and it will again die after executing the query. This is why you are seeing a restart loop.</p>
<p>For busy box, the entrypoint is a long running command like sleep 3600 <a href="https://github.com/kubernetes/kubernetes/blob/master/hack/testdata/recursive/pod/pod/busybox.yaml#L10-L12" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/blob/master/hack/testdata/recursive/pod/pod/busybox.yaml#L10-L12</a>.</p>
<p>You should either try something similar or try Kubernetes cron job if the idea is to run the query on a schedule.</p>
