<p>I am using the <a href="https://gitlab.com/gitlab-org/charts/gitlab/-/blob/master/values.yaml" rel="nofollow noreferrer">Gitlab helm chart</a> to install Gitlab on my cluster. I want to set initialRootPassword so that I can login without doing kubectl get secret</p>
<pre><code>  ## Initial root password for this GitLab installation
  ## Secret created according to doc/installation/secrets.md#initial-root-password
  ## If allowing shared-secrets generation, this is OPTIONAL.  
  initialRootPassword: {}
    # secret: RELEASE-gitlab-initial-root-password
    # key: password
</code></pre>
<p>The above block is a bit confusing. Can you please help me with this? Thanks.</p>

Karthick Sundar
<p>The initialRootPassword refers to a <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">secret</a> object within kubernetes, so you must first create a secret within the same namespace as your gitlab instance and then point initialRootPassword to it.</p>
<p>For example, if you want the root password to be &quot;password&quot;, first you need to base64 encode it</p>
<pre><code>$ echo -n &quot;password&quot;|base64
cGFzc3dvcmQ=
</code></pre>
<p>Then add it to kubernetes</p>
<pre><code># secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: gitlab-root-password
data:
  password: cGFzc3dvcmQ=
</code></pre>
<pre><code>kubectl apply -f secret.yaml
</code></pre>
<p>There are other ways to create the secret, <a href="https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#create-a-secret" rel="nofollow noreferrer">see the docs</a> for more info on that.</p>
<p>You can then set the initialRootPassword</p>
<pre><code>initialRootPassword:
    secret: gitlab-root-password
    key: password
</code></pre>
<p>The key here refers to the name of the data key in the secret object.</p>
<p>An alternative is to use Gitlab <a href="https://docs.gitlab.com/charts/installation/command-line-options.html#basic-configuration" rel="nofollow noreferrer">default values</a> which allow you to create a secret object that will be used automatically without explicitly setting initialRootPassword</p>
<p>This example is taken from <a href="https://docs.gitlab.com/charts/installation/secrets.html#initial-root-password" rel="nofollow noreferrer">gitlab docs</a> (Replace <code>&lt;name&gt;</code> with the name of the release).</p>
<pre><code>kubectl create secret generic &lt;name&gt;-gitlab-initial-root-password --from-literal=password=$(head -c 512 /dev/urandom | LC_CTYPE=C tr -cd 'a-zA-Z0-9' | head -c 32)
</code></pre>
