Reputation: 12358
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
kubectl
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
prometheus:
name: prometheus
server:
configMapOverrideName: prometheus-config
persistentVolume:
enabled: true
storageClass: azurefile
size: 10Gi
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
Upvotes: 0
Views: 8751
Reputation: 31
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://learn.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv
Upvotes: 1