<p>I have a .pfx file that a Java container needs to use.</p>
<p>I have created a tls secret using the command</p>
<p><code>kubectl create secret tls secret-pfx-key --dry-run=client --cert tls.crt --key tls.key -o yaml</code></p>
<pre><code>apiVersion: v1
kind: Secret
type: kubernetes.io/tls
metadata:
  name     : secret-pfx-key
  namespace: default
data:
  #cat tls.crt | base64
  tls.crt: base64-gibberish....
  #cat tls.key | base64
  tls.key: base64-gibberish....
</code></pre>
<p>However, now I cannot understand how to use it. When I add the secret as volume in the pod I can see the two files that are created. But I need the combination of the two in one .pfx file.</p>
<p>Am I missing something? Thanks.</p>
<p>Note: I have read the related stackoverflow questions but could not understand how to use it.</p>

Kostas Demiris
<p>You can <a href="https://www.sslshopper.com/ssl-converter.html" rel="nofollow noreferrer">convert</a> to pfx first, then <code>kubectl create secret generic mypfx --from-file=pfx-cert=&lt;converted pfx file&gt;</code></p>
<p>Mount the secret as a volume in your pod:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-mypfx
spec:
  restartPolicy: OnFailure
  volumes:
  - name: pfx-volume
    secret:
      secretName: mypfx
  containers:
  - name: busybox
    image: busybox
    command: [&quot;ash&quot;,&quot;-c&quot;,&quot;cat /path/in/the/container/pfx-cert; sleep 5&quot;]
    volumeMounts:
    - name: pfx-volume
      mountPath: /path/in/the/container
</code></pre>
<p>The above example dump the cert, wait for 5s and exit.</p>
