<p>I have several secrets that are mounted and need to be read as a properties file. It seems kubernetes can't mount them as a single file so I'm trying to concatenate the files after the pod starts. I tried running a cat command in a postStart handler but it seems execute before the secrets are mounted as I get this error:</p>
<pre><code>Error: failed to create containerd task: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: &quot;cat /properties/S3Secret /properties/S3Key &gt;&gt; /properties/dbPassword&quot;: stat cat /properties/S3Secret /properties/S3Key &gt;&gt; /properties/dbPassword: no such file or directory: unknown
</code></pre>
<p>Then here is the yaml.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: K8S_ID
spec:
  selector:
    matchLabels:
      app: K8S_ID
  replicas: 1
  template:
    metadata:
      labels:
        app: K8S_ID
    spec:
      containers:
        - name: K8S_ID
          image: IMAGE_NAME
          ports:
            - containerPort: 8080
          env:
            - name: PROPERTIES_FILE
              value: &quot;/properties/dbPassword&quot;
          volumeMounts:
            - name: secret-properties
              mountPath: &quot;/properties&quot;
          lifecycle:
            postStart:
              exec:
                command: [&quot;cat /properties/S3Secret /properties/S3Key &gt;&gt; /properties/dbPassword&quot;]
      volumes:
        - name: secret-properties
          secret:
            secretName: secret-properties
            items:
              - key: SECRET_ITEM
                path: dbPassword
              - key: S3Key
                path: S3Key
              - key: S3Secret
                path: S3Secret
</code></pre>

<p>You need a shell session for your command like this:</p>
<pre><code>...
lifecycle:
  postStart:
    exec:
      command: [&quot;/bin/sh&quot;,&quot;-c&quot;,&quot;cat /properties/S3Secret /properties/S3Key &gt;&gt; /properties/dbPassword&quot;]
...
</code></pre>
