0

I'm having trouble to deploy Influxdb2 into my Azure AKS Cluster. I'm using a simple storage account to serve as storage. Looking the influxdb pod:

** ts=2021-11-26T00:43:44.126091Z lvl=error msg=“Failed to apply SQL migrations” log_id=0Y2Q~wH0000 error=“database is locked” ** Error: database is locked

1 Answers1

0

I change my PVC to use CSI:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: sc-influxdb
  namespace: #{NAMESPACE}#
provisioner: file.csi.azure.com
allowVolumeExpansion: true
parameters:
  storageAccount: #{STORAGE_ACCOUNT_NAME}#
  location: #{STORAGE_ACCOUNT_LOCATION}#
  # Check driver parameters here:
  # https://github.com/kubernetes-sigs/azurefile-csi-driver/blob/master/docs/driver-parameters.md
reclaimPolicy: Delete
volumeBindingMode: Immediate
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=0
  - gid=0
  - mfsymlinks
  - cache=strict  # https://linux.die.net/man/8/mount.cifs
  - nosharesock  # reduce probability of reconnect race
  - actimeo=30  # reduce latency for metadata-heavy workload
---
# Create a Secret to hold the name and key of the Storage Account
# Remember: values are base64 encoded
apiVersion: v1
kind: Secret
metadata:
  name: #{STORAGE_ACCOUNT_NAME}#
  namespace: #{NAMESPACE}#
type: Opaque
data:
  azurestorageaccountname: #{STORAGE_ACCOUNT_NAME_B64}#
  azurestorageaccountkey: #{STORAGE_ACCOUNT_KEY_B64}#

---
# Create a persistent volume, with the corresponding StorageClass and the reference to the Azure File secret.
# Remember: Create the share in the storage account otherwise the pods will fail with a "No such file or directory"
apiVersion: v1
kind: PersistentVolume
metadata:
  name: influxdb-pv
spec:
  capacity:
    storage: 5Ti
  accessModes:
  - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: sc-influxdb
  claimRef:
    name: influxdb-pvc
    namespace: #{NAMESPACE}#
  azureFile:
    secretName: #{STORAGE_ACCOUNT_NAME}#
    secretNamespace: #{NAMESPACE}#
    shareName: influxdb
    readOnly: false
  mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=0
  - gid=0
  - mfsymlinks
  - cache=strict
  - nosharesock
  - nobrl

---
# Create a PersistentVolumeClaim referencing the StorageClass and the volume
# Remember: this is a static scenario. The volume was created in the previous step.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: influxdb-pvc
  namespace: #{NAMESPACE}#
spec:
  accessModes:
    - ReadWriteMany  
  resources:
    requests:
      storage: 5Ti
  storageClassName: sc-influxdb
  volumeName: influxdb-pv

In my values.yml I defined my persistence as:

## Persist data to a persistent volume
##
persistence:
  enabled: true
  ## If true will use an existing PVC instead of creating one
  useExisting: true
  ## Name of existing PVC to be used in the influx deployment
  name: influxdb-pvc
  ## influxdb data Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  # storageClass: sc-influxdb
  size: 5Ti

To install I ran:

helm upgrade --install influxdb influxdata/influxdb2 -n influxdb -f values.yml