<p>I am seeing a very strange issue trying to start the official <code>postgres:14.6-alpine</code> image on Kubernetes.</p>
<p>For reference the official postgres image allows for configuring the initialization script using the <code>POSTGRES_USER</code>, <code>POSTGRES_PASSWORD</code>, and <code>POSTGRES_DB</code> environment variables.</p>
<p>I have the following secret and configmap defined:</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: v1
kind: Secret
metadata:
  namespace: default
  name: postgres-credentials
data:
  DATABASE_URL: cG9zdGdyZXM6Ly9sZXRzY2h1cmNoOnBhc3N3b3JkQHBvc3RncmVzOjU0MzIvbGV0c2NodXJjaA==
  POSTGRES_USER: bGV0c2NodXJjaA==
  POSTGRES_PASSWORD: cGFzc3dvcmQ=
---
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: default
  name: postgres-config
data:
  POSTGRES_DB: letschurch
</code></pre>
<p>The value <code>POSTGRES_USER</code> value of <code>bGV0c2NodXJjaA==</code> decodes to <code>letschurch</code> and the <code>POSTGRES_PASSWORD</code> value of <code>cGFzc3dvcmQ=</code> decodes to <code>password</code>.</p>
<p>I also have the following deployment:</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
  labels:
    app: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      restartPolicy: Always
      containers:
        - image: postgres:14.6-alpine
          name: postgres
          ports:
            - containerPort: 5432
          envFrom:
            - configMapRef:
                name: postgres-config
            - secretRef:
                name: postgres-credentials
</code></pre>
<p>When I shell into the running container, I can echo out the environment variables, and they appear to be intact:</p>
<pre><code>postgres-74f67b778-lsv4c:/# echo $POSTGRES_USER
letschurch
postgres-74f67b778-lsv4c:/# echo $POSTGRES_PASSWORD
password
postgres-74f67b778-lsv4c:/# echo $POSTGRES_DB
letschurch
postgres-74f67b778-lsv4c:/# echo -n $POSTGRES_USER | wc -c
10
postgres-74f67b778-lsv4c:/# echo -n $POSTGRES_PASSWORD | wc -c
8
postgres-74f67b778-lsv4c:/# echo -n $POSTGRES_DB | wc -c
10
postgres-74f67b778-lsv4c:/# [ &quot;$POSTGRES_USER&quot; = &quot;$POSTGRES_DB&quot; ] &amp;&amp; echo 'good!'
good!
</code></pre>
<p>However, I am not able to connect with the role <code>letschurch</code>. I can connect as <code>temporal</code> (another role I have set up with an init script), and when I run <code>\l</code> and <code>\du</code> I see that the role (but not the database name) have a <code>+</code> appended:</p>
<pre><code>temporal=&gt; \l
                                        List of databases
        Name         |   Owner    | Encoding |  Collate   |   Ctype    |    Access privileges     
---------------------+------------+----------+------------+------------+--------------------------
 letschurch          | letschurch+| UTF8     | en_US.utf8 | en_US.utf8 | 

temporal=&gt; \du
                                    List of roles
 Role name  |                         Attributes                         | Member of 
------------+------------------------------------------------------------+-----------
 letschurch+| Superuser, Create role, Create DB, Replication, Bypass RLS | {}
            |                                                            | 
 temporal   |                                                            | {}
</code></pre>
<p>At first I thought that the base64-encoded <code>POSTGRES_USER</code> environment variable might have some whitespace or something encoded in it, so I double checked that I was encoding the value properly with <code>echo -n letschurch | base64</code>, and as you can see in the shell output above the resulting value is exactly 10 characters long, no extra whitespace. Also, the <code>POSTGRES_USER</code> and <code>POSTGRES_DB</code> environment variables are equal, but they appear to result in different outcomes in postgres.</p>
<p>Also, this does not happen with <code>docker-compose</code>. Given the following configuration, everything works as expected:</p>
<pre class="lang-yaml prettyprint-override"><code>  postgres:
    image: postgres:14.6-alpine
    environment:
      POSTGRES_USER: letschurch
      POSTGRES_PASSWORD: password
      POSTGRES_DB: letschurch
    ports:
      - '5432:5432'
</code></pre>
<p>What am I missing here? Why does the <code>letschurch</code> role get a <code>+</code> appended to it? Is there something to do with <code>secret</code>s that doesn't apply to <code>configMap</code>s that I'm missing?</p>

knpwrs
<p>I think this had to do with a specific setting I had enabled for Docker Desktop for Mac:</p>
<p><a href="https://i.stack.imgur.com/7f60o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7f60o.png" alt="Docker Desktop Settings" /></a></p>
<p>I had changed from the default value (<code>gRPC FUSE</code>) to <code>VirtioFS</code>. When I changed it back to <code>gRPC FUSE</code> a number of issues resolved themselves, this one included.</p>
