title: Unable to mount volumes for pod on AKS
body: <p>I would like to use sonar-qube and deploy it on AKS (Azure Kubernetes). I want to store sonar logs, data, conf and extension on persistent volumes.  However, it looks like AKS is not able to mount the volumes due to timeout.</p>
  
  <p>I have build a single script that create volume + service + deployment and ingress. --> no success</p>
  
  <p>I have tried to separate the volume creation from application creation and volume attachement --> no success</p>
  
  <p><a href="https://i.stack.imgur.com/EELlY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EELlY.png" alt="Error"></a></p>
  
  <p>However, volumes are created and available on AZURE</p>
  
  <p><a href="https://i.stack.imgur.com/pa6EQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pa6EQ.png" alt="enter image description here"></a></p>
  
  <p>Configuration : </p>
  
  <ul>
  <li>AKS version : 1.14.5</li>
  <li>Hardware types :Standard DS2 v2 (2 vcpus, 7 GiB memory)</li>
  </ul>
  
  <p>Here is the scripts I use to create the volumes :</p>
  
  <pre><code>#Namespace creation
  apiVersion: v1
  kind: Namespace
  metadata: 
    name: cicd
    labels: 
      name: cicd
  ---
  #PVC for Sonar’s data directory creation
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: sonar-data
    namespace: cicd  
  spec:
    accessModes:
    - ReadWriteOnce
    storageClassName: default
    resources:
      requests:
        storage: 5G
  ---
  #PVC for Sonar’s conf directory
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: sonar-conf
    namespace: cicd  
  spec:
    accessModes:
    - ReadWriteOnce
    storageClassName: default
    resources:
      requests:
        storage: 5Gi
  ---
  #PVC for Sonar’s logs directory
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: sonar-logs
    namespace: cicd  
  spec:
    accessModes:
    - ReadWriteOnce
    storageClassName: default
    resources:
      requests:
        storage: 10Gi
  ---
  #PVC for Sonar’s extensions directory
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: sonar-extensions
    namespace: cicd  
  spec:
    accessModes:
    - ReadWriteOnce
    storageClassName: default
    resources:
      requests:
        storage: 5Gi
  ---
  #Create secretKeyRef
  
  apiVersion: v1
  kind: Secret
  metadata:
    name: sonar-secret
    namespace: cicd
  type: Opaque
  data:
    password: *****************
  </code></pre>
  
  <p>Here is the script I use to create sonar :</p>
  
  <pre><code>#SonarQube deployment
  apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    labels:
      app: sonarqube
    name: sonarqube
    namespace: cicd
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: sonarqube
      spec:
        securityContext:
          runAsUser: 0
          fsGroup: 0    
        containers:
          - name: sonarqube
            image: sonarqube:latest
            resources:
              requests:
                cpu: 500m
                memory: 1024Mi
              limits:
                cpu: 2000m
                memory: 2048Mi
            volumeMounts:
            - mountPath: "/opt/sonarqube/data/"
              name: sonar-data
            - mountPath: "/opt/sonarqube/extensions/"
              name: sonar-extensions
            - mountPath: "/opt/sonarqube/logs/"
              name: sonar-logs
            - mountPath: "/opt/sonarqube/conf/"
              name: sonar-conf
            env:
            - name: "SONARQUBE_JDBC_USERNAME"
              value: "sonar"
            - name: "SONARQUBE_JDBC_URL"
              value: "jdbc:sqlserver://internal-sql-az-westeurope.database.windows.net:1433;databaseName=Sonar;user=SONARQUBE_JDBC_USERNAME;password=SONAR_SQL_LOGIN_PASSWORD"
            - name: "SONARQUBE_JDBC_PASSWORD"
              valueFrom:
                secretKeyRef:
                  name: sonar-secret
                  key: password
            ports:
            - containerPort: 9000
              protocol: TCP
        volumes:
        - name: sonar-data
          persistentVolumeClaim:
            claimName: sonar-data
        - name: sonar-extensions
          persistentVolumeClaim:
            claimName: sonar-extensions
        - name: sonar-logs
          persistentVolumeClaim:
            claimName: sonar-logs
        - name: sonar-conf
          persistentVolumeClaim:
            claimName: sonar-conf
  ---
  # --------------
  # Service Object
  # --------------
  apiVersion: v1
  kind: Service
  metadata:
    labels:
      name: sonarqube
    name: sonarqube-service
    namespace: cicd
  spec:
    ports:
      - port: 80 # Default port for image
        protocol: TCP
    selector:
      name: sonarqube
  
  # -----------------
  # Ingress object
  # -----------------
  ---
  apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: sonarqube-api-ingress
    namespace: cicd
    annotations:
      kubernetes.io/ingress.class: nginx
      #Default is 'true'
      #nginx.ingress.kubernetes.io/ssl-redirect: "false" 
      nginx.ingress.kubernetes.io/rewrite-target: /$1
      #https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#whitelist-source-range
      nginx.ingress.kubernetes.io/whitelist-source-range: "******"    
  spec:
    tls:
    - hosts:
      - sonar.traceparts.com
      secretName: aks-ingress-tls-star-traceparts-com 
    rules:
    - host: sonar.traceparts.com
      http:
        paths:     
        - backend:
            serviceName: sonarqube-service
            servicePort: 80
          path: /(.*)         
  </code></pre>
  
  <p>Can someone helps me to understand the issue?</p>