<p>I am kind of new to AKS deployment with volume mount. I want to create a pod in AKS with image; that image needs a volume mount with config.yaml file (that I already have and needs to be passed to that image to run successfully).</p>
<p>Below is the docker command that is working on local machine.</p>
<pre><code>docker run -v &lt;Absolute_path_of_config.yaml&gt;:/config.yaml image:tag
</code></pre>
<p>I want to achieve same thing in AKS. When I tried to deploy same using Azure File Mount (with PersistentVolumeClaim) volume is getting attached. The question now is how to pass config.yaml file to that pod. I tried uploading config.yaml file to Azure File Share Volume that is attached in POD deployment without any success.</p>
<p>Below is the pod deployment file that I used</p>
<pre><code>kind: Pod
apiVersion: v1
metadata:
  name: mypod
spec:
  containers:
  - name: mypod
    image: image:tag
    resources:
      requests:
        cpu: 100m
        memory: 128Mi
      limits:
        cpu: 250m
        memory: 1Gi
    volumeMounts:
    - mountPath: &quot;/config.yaml&quot;
      name: volume
  volumes:
    - name: volume
      persistentVolumeClaim:
        claimName: my-azurefile-storage
</code></pre>
<p>Need help regarding how I can use that local config.yaml file for aks deployment so image can run properly.</p>
<p>Thanks in advance.</p>

Abhinandan Bharamgunde
<p>Create a kubernetes secret using <code>config.yaml</code> file.</p>
<pre><code>kubectl create secret generic config-yaml --from-file=config.yaml
</code></pre>
<p>Mount it as a volume in the pod.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: config
spec:
  containers:
  - name: config
    image: alpine
    command:
    - cat
    resources: {}
    tty: true
    volumeMounts:
      - name: config
        mountPath: /config.yaml
        subPath: config.yaml
  volumes:
    - name: config
      secret:
        secretName: config-yaml
</code></pre>
<p>Exec to the pod and view the file.</p>
<pre><code>kubectl exec -it config sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
/ # ls
bin          dev          home         media        opt          root         sbin         sys          usr
config.yaml  etc          lib          mnt          proc         run          srv          tmp          var
/ # cat config.yaml 
---
apiUrl: &quot;https://my.api.com/api/v1&quot;
username: admin
password: password
</code></pre>
