Helm – How to change the storage class used by PostgreSQL when deploying Keycloak

I am using the Keycloak helm chart from codecentric. The chart depends on the PostgreSQL chart form bitnami, and by default the PostgreSQL chart uses the default storage class.

Looking values.yaml, I can see there is a section for postgresql, but there is no mention of the storage class. Is it possible to use Keycloak values.yaml file to override that setting?

The other option, that I would rather avoid, is to set enabled: false and deploy the PostgreSQL chart separately – hopefully that is not necessary.

postgresql:
  # If `true`, the Postgresql dependency is enabled
  enabled: true
  # PostgreSQL User to create
  postgresqlUsername: keycloak
  # PostgreSQL Password for the new user
  postgresqlPassword: keycloak
  # PostgreSQL Database to create
  postgresqlDatabase: keycloak
  # PostgreSQL network policy configuration
  networkPolicy:
    enabled: false

>Solution :

Looking at the postgres values file I can see that you can change the value under global.storageClass.

Since postgres is a subchart, you can either add the above to your custome values file, or pass the storage class in your helm install command, like helm install –set postgresql.global.storageClass="yourStorageClass"`

You can also refer to this.

Leave a Reply