<p>I am running an Elasticsearch stack with Kibana and Fluent Bit on Kubernetes. To set up security I set a passwords using this command:</p>
<pre><code>kubectl exec -it $(kubectl get pods -n logging | grep elasticsearch-client | sed -n 1p | awk '{print $1}') -n logging -- bin/elasticsearch-setup-passwords auto -b
</code></pre>
<p>Following <a href="https://www.studytonight.com/post/setup-elasticsearch-with-authentication-xpack-security-enabled-on-kubernetes" rel="nofollow noreferrer">this tutorial</a></p>
<p>As during development, I have to do this setup quite often I want to automate this step, but I can not quite get it working. As I am using <a href="https://docs.tilt.dev/tiltfile_concepts.html" rel="nofollow noreferrer">Tiltfiles</a> my first instinct was to call a bash script from there but as <code>Starlark</code> does not support this, it is not an option. My next attempt was to try it with <code>Init Containers</code> but as they can not access the other containers this also did not work.
Does anyone know what the correct way to do this is?</p>

Manuel 
<p>As @David Maze pointed out I should put the (bootstrap) password into a <code>secret</code>.</p>
<p>My initial problem was that I thought that the <code>elasticsearch-setup-passwords</code> tool was the only way to set up the (user) password.</p>
<p>In other words, I did not know the password before the program was started.
But I just found a way to change the bootstrap password beforehand <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-users.html" rel="nofollow noreferrer">here</a>, so the problem is solved.</p>
