0
votes

background

I am new to kubernetes, I am trying to install stable/prometheus using helm charts on AKS cluster and want to set up a persistent volume for it to consume.

when you create a AKS cluster it keeps all the actual resources in a resource group MC_XXX_XXXX

  • I manually created ABC-BLOB-STORAGE via the azure via azure portal
  • created the persistant volume using kubectl
  • tried install prometheus via helm with a values file

Persistent Volume

apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
  name: azurefile
  annotations:
    storageclass.beta.kubernetes.io/is-default-class: "true"
  labels:
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: EnsureExists
provisioner: kubernetes.io/azure-disk
parameters:
  skuName: Standard_LRS
  location: eastus
  storageAccount: ABC-BLOB-STORAGE

Values.YAML (snippet related to storage looks like)

prometheus:
    name: prometheus
    server:
      configMapOverrideName: prometheus-config
        persistentVolume:
          enabled: true
          storageClass: azurefile
          size: 10Gi

Error

when I install prometheus using helm :

helm install stable/prometheus --name d02 -f values.yaml

Error: release d02 failed: persistentvolumeclaims "d02-prometheus-alertmanager" is forbidden

  • Feels like kubernetes needs access to the blob storage. I can pass in the access token but not sure how
1

1 Answers

1
votes

I'm not sure if you can just mount a PersistentVolume that doesn't exist yet and have it get auto-provisioned, I think you need to make a PersistentVolumeClaim first. The claim initiates the provisioning (or reclaiming) of the volume from theStorageClass, the secret for the volume should automatically be created upon provisioning. Try the following

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: azurefile
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: azurefile
  resources:
    requests:
      storage: 10Gi

To use the claim in your pod, something like this should work.

prometheus:
    name: prometheus
    server:
      configMapOverrideName: prometheus-config
         volumeMounts:
         - mountPath: "/foo/mount_point"
           name: volume
         volumes:
           - name: volume
             persistentVolumeClaim:
               claimName: azurefile

Following: https://docs.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv