stackabletech / nifi-operator

A kubernetes operator for Apache NiFi
Other
28 stars 4 forks source link

I can't understand how increase pvc in nificluster #474

Closed grandeon closed 1 year ago

grandeon commented 1 year ago

Hi everybody,

I'm trying to increase the deafult pvc for a nifi cluster but I can't got it. This is the configuration I'm using:

apiVersion: nifi.stackable.tech/v1alpha1
kind: NifiCluster
metadata:
  name: apm-nifi
  namespace: nifi-experiments
spec:
  image:
    productVersion: "1.18.0"
    stackableVersion: "23.4.0"
  clusterConfig:
    listenerClass: cluster-internal
    authentication:
      method:
        singleUser:
          adminCredentialsSecret: nifi-admin-credentials-apm
          autoGenerate: false
    sensitiveProperties:
      keySecret: nifi-sensitive-property-key
      autoGenerate: true
    zookeeperConfigMapName: apm-nifi-znode
  nodes: # role-level
    config:
      resources:
        cpu:
          min: "500m"
          max: "4"
        memory:
          limit: "8Gi"
    roleGroups: # role-group-level
      base: # role-group 1
        replicas: 0
      high: # role-group 2
        replicas: 1
        config:
          resources:
            storage:
              flowfile_repo:
                capacity: "12Gi"
              provenance_repo:
                capacity: "12Gi"
              database_repo:
                capacity: "12Gi"
              content_repo:
                capacity: "12Gi"
              state_repo:
                capacity: "12Gi"
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
              - matchExpressions:
                - key: dedicated
                  operator: In
                  values:
                  - nifi
        configOverrides:
          nifi.properties:
            nifi.web.proxy.host: "nifi.xxxx.xxxx.com:443"

The configOverrides section works fine. I can increase the cpu and memory resources, but not the storage. Always I get the default pvc size.

What is my misconfiguration? Can someone help me?

Thank you so much!!

maltesander commented 1 year ago

Hi @grandeon,

can you please specify the operator version you are using?

We currently do not support increasing existing PVCs (working on that).

So updating the PVC size of a running cluster is currently only possible manually.

In case you want to create a new cluster with bigger PVCs please try (camelCase instead of snake_case for the repo specification):

      high: # role-group 2
        replicas: 1
        config:
          resources:
            storage:
              flowfileRepo:
                capacity: "12Gi"
              provenanceRepo:
                capacity: "12Gi"
              databaseRepo:
                capacity: "12Gi"
              contentRepo:
                capacity: "12Gi"
              stateRepo:
                capacity: "12Gi"

I hope this helps.

Cheers, Malte

sbernauer commented 1 year ago

You can increase the size of an already existent pvc using e.g. https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/

grandeon commented 1 year ago

Hi @grandeon,

can you please specify the operator version you are using?

We currently do not support increasing existing PVCs (working on that).

So updating the PVC size of a running cluster is currently only possible manually.

In case you want to create a new cluster with bigger PVCs please try (camelCase instead of snake_case for the repo specification):

      high: # role-group 2
        replicas: 1
        config:
          resources:
            storage:
              flowfileRepo:
                capacity: "12Gi"
              provenanceRepo:
                capacity: "12Gi"
              databaseRepo:
                capacity: "12Gi"
              contentRepo:
                capacity: "12Gi"
              stateRepo:
                capacity: "12Gi"

I hope this helps.

Cheers, Malte

These are my operator's releases:

helm list -n stackable
NAME                NAMESPACE   REVISION    UPDATED                                     STATUS      CHART                           APP VERSION
commons-operator    stackable   1           2023-05-22 15:44:37.780486365 +0200 CEST    deployed    commons-operator-0.0.0-dev      0.0.0-dev  
nifi-operator       stackable   1           2023-05-22 15:45:31.792361638 +0200 CEST    deployed    nifi-operator-0.0.0-dev         0.0.0-dev  
secret-operator     stackable   3           2023-05-25 16:42:01.018496377 +0200 CEST    deployed    secret-operator-0.0.0-dev       0.0.0-dev  
zookeeper-operator  stackable   1           2023-05-22 15:45:17.052818755 +0200 CEST    deployed    zookeeper-operator-0.0.0-dev    0.0.0-dev 

But I tried too with the stable version with the same problem:

helm install --wait commons-operator stackable-stable/commons-operator --version 23.4.0 -n stackable
helm install --wait secret-operator stackable-stable/secret-operator --version 23.4.0 -n stackable
helm install --wait zookeeper-operator stackable-stable/zookeeper-operator --version 23.4.0 -n stackable
helm install --wait nifi-operator stackable-stable/nifi-operator --version 23.4.0 -n stackable

I can't understand this:

In case you want to create a new cluster with bigger PVCs please try (camelCase instead of snake_case for the repo specification):

Thank you very much and sorry for my lack of knowledge

grandeon commented 1 year ago

You can increase the size of an already existent pvc using e.g. https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/

This has worked for me as a workaround and as a possible way to increase volume in the future.

My question was more about the option to request more storage when creating the cluster, but it works for me at least for now.

Thank you so much!

# Before
...
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 2Gi
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2023-05-30T13:37:05Z"
    status: "True"
    type: Resizing
  phase: Bound
# after: 
...
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 12Gi
...
sbernauer commented 1 year ago

Hi @grandeon, so basically we support specifying the pvc sizes when creating the cluster. Watch out, you need to use the example @maltesander provided (there are some typos - e.g. use config.resources.storage.flowfileRepo instead of config.resources.storage.flowfile_repo). In case you want to change your pvc size afterwards that's a thing we currently don't support out of the box. You can find details in https://github.com/stackabletech/trino-operator/issues/342. To put it short, we are not allowed to change the volume size from the StatefulSet containing NiFi. So (and only) in that case you need to manually resize the pvc, until we have solved the problem.

grandeon commented 1 year ago

The branches did not let me see the forest! Now I understand the different between camelCase and snake_case for the repo specification! Thank you very much and sorry @sbernauer and @maltesander, maybe my question was too basic!

And many thanks to all of you who make Stackable possible!

sbernauer commented 1 year ago

That's totally fine, we can't know everything! Glad it worked out for you! Is their any outdated documentation that we should fix/improve to prevent users running into the same issue again? (e.g. where config.resources.storage.flowfile_repo is written down)

All the best, Sebastian

grandeon commented 1 year ago

I followed the NiFi Operator documentation where it still uses snacke_case:

https://docs.stackable.tech/home/stable/nifi/usage_guide/resource-configuration.html

Thank you so much!

sbernauer commented 1 year ago

Thanks for pointing that out! Will fix it immediately. (Because the docs are version will will only show up in the nightly version and afterwards in 23.7)

sbernauer commented 1 year ago

Oh it's already fixed in the nightly version. Will be in the stable version once we release 23.7: https://docs.stackable.tech/home/nightly/nifi/usage_guide/resource-configuration.html