<p>I am running a minio deployment in a Kubernetes Cluster.
I used to have the access- and secret key in clear text in the yaml files as follows:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: minio
spec:
...
      containers:
        - name: minio
          volumeMounts:
            - name: data
              mountPath: &quot;/data&quot;
          image: minio/minio:RELEASE.2021-04-06T23-11-00Z
          args:
            - gateway
            - nas
            - /data
          env:
            - name: MINIO_ACCESS_KEY
              value: &quot;minio&quot;
            - name: MINIO_SECRET_KEY
              value: &quot;mysupersecretkey&quot;
...
</code></pre>
<p>This works fine.
However when I move the credetials into a kubernetes secret, minio does no longer recognize these credetials, even though they are loaded into the same environment variables:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
...
      containers:
        - name: minio
          ...
          env:
            - name: MINIO_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: minio-secret
                  key: minioAccessKey
            - name: MINIO_SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: minio-secret
                  key: minioSecretKey
...
</code></pre>
<p>I can confirm, that these credentials get mounted properly into the container as environment variables:</p>
<pre class="lang-sh prettyprint-override"><code>$ echo $MINIO_ACCESS_KEY
minio
$ echo $MINIO_SECRET_KEY
mysupersecretkey
</code></pre>
<p>But minio does not recognize these credentials:</p>
<p><a href="https://i.stack.imgur.com/7axqf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7axqf.png" alt="minio error" /></a></p>
<p>Is there any difference, to how these variables are used, when they originate from a kubernetes secret?</p>
<p><strong>EDIT</strong></p>
<p>I have also tried with the <code>MINIO_ROOT_USER</code> and <code>MINIO_ROOT_PASSWORD</code> variables, as the docs suggest. However, resulting in the same error using kubernetes secrets and no error with clear text.</p>

sekthor
<p>I have solved the problem, which was caused by the way the credentials were written into the Kubernetes secrets.
It turned out, that the tools I was using appended a <code>\n (0x0a)</code> newline character to the base64 encoded secret.</p>
<p>This is why the credentials never matched what I entered into the login UI.</p>
