<p>Is it possible to use secrets on a containerPort?</p>

<p>For example:</p>

<pre><code>spec:
  containers:
    - name: postgres
      image: testproject/postgres
      ports:
        - containerPort: 5432
</code></pre>

<p>Doing something like:</p>

<pre><code>  containers:
    - name: postgres
      image: testproject/postgres
      ports:
        - containerPort:
          valueFrom:
            secretKeyRef:
              name: app-secrets
              key: PGPORT
</code></pre>

<p>Tested it and it doesn't work so seeing if there is a different syntax.</p>

<p>I'm probably being overly cautious, but figured it would be more secure to not have the port in plain text somewhere, even though that port wouldn't be available publicly. </p>

cjones
<p>I don't think it's doable. I recommend focusing on setting up database privileges and using secrets with your database passwords.</p>
