Home > Mobile >  Mounting volume is missing on pod deployment > AKS > Kubernetes
Mounting volume is missing on pod deployment > AKS > Kubernetes

Time:12-07

Afternoon, For some reason, our AKS deployment of namespace/container/service fails to mount a file share Code used is

- apiVersion: v1
  kind: Namespace
  metadata:
    name: hvi-cma-aks
  spec:
    finalizers:
      - kubernetes
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: hvi
    namespace: hvi-cma-aks
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: hvi
    template:
      metadata:
        labels:
          app: hvi
      spec:
        nodeSelector:
          kubernetes.io/os: linux
        containers:
          - name: hvi
            image: cmaregistry2.azurecr.io/cma/hvi:v7.1.0
            ports:
              - containerPort: 80
              - containerPort: 443
            resources:
              requests:
                cpu: '0'
                memory: '0'
              limits:
                cpu: '256'
                memory: 11400G
            env:
            - name: ConnectionStrings__CMA_LogConnectionString
              value: "Server=cs-mi-poc02.4ba4f978f6bd.database.windowsgnignore.net;Database=CMA_Log;TrustServerCertificate=True"
            - name: ConnectionStrings__CMA_MessagesConnectionString
              value: "Server=cs-mi-poc02.4ba4f978f6bd.database.windows.net;Database=CMA_Messages;TrustServerCertificate=True"
            - name: ConnectionStrings__CMA_ODSConnectionString
              value: "Server=cs-mi-poc02.4ba4f978f6bd.database.windows.net;Database=CMA_ODS;TrustServerCertificate=True"
            - name: ConnectionStrings__SplitQueueConnection
              value: "azure:[email protected]:5672"
            - name: Properties__ReqRequestFilePath
              value: "XML/Request.xml"   
            - name: Properties__RespAcceptFilePath
              value: "XML/Accept.xml"
            - name: Properties__RespMessagesFilePath
              value: "XML/Messages.xml"
            - name: Diagnostics__Enabled
              value: "true"
            - name: Diagnostics__RequestLogFile
              value: "/trace/InputTrace.webinfo.xml"
            - name: Diagnostics__ResponseLogFile
              value: "/trace/OutputTrace.webinfo.xml"
    volumeMounts:
      - name: azure
        mountPath: /logs
  volumes:
  - name: azure
    azureFile:
      secretName: storage-secret
      shareName: logs
      readOnly: false
- apiVersion: v1
  kind: Service
  metadata:
    name: hvi-service
    namespace: hvi-cma-aks
  spec:
    type: ClusterIP
    ports:
      - targetPort: 80
        name: port80
        port: 80
        protocol: TCP
      - targetPort: 443
        name: port443
        port: 443
        protocol: TCP
    selector:
      app: hvi

The file share that never mounts is the one named Azure. However i can mount this when i deploy the yaml file and omit the service part. It then mounts but misses the environment variables. Am i missing something? > i have removed the SQL details from the code

Tried YAML file omitting the service fields, the share loads

CodePudding user response:

Looks like you're using a deprecated volume plugin for azurefiles (source)

Azure File CSI driver should work instead - AKS Mount File Share as Inline volume. The volume portion of the yaml field should look like:

 volumes:
 - name: azure
   csi:
     driver: file.csi.azure.com
     readOnly: false
     volumeAttributes:
       secretName: storage-secret
       shareName: logs

Let me know if this works! :-)

CodePudding user response:

Issue related to indentation, now working

  • Related