Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MountVolume.SetUp failed for volume "realm-secret" : secrets "realm-secret" not found

I am trying to get keycloak up and running on my minikube.

I am installing keycloak with

helm upgrade -i -f kubernetes/keycloak/values.yaml keycloak stable/keycloak --set keycloak.persistence.dbHost=rolling-newt-postgresql

I see an error in dashboard that says:

MountVolume.SetUp failed for volume "realm-secret" : secrets "realm-secret" not found

In my values.yaml I have this configuration:

  extraVolumes: |
    - name: realm-secret
      secret:
        secretName: realm-secret
    - name: theme
      emptyDir: {}
    - name: spi
      emptyDir: {}
  extraVolumeMounts: |
    - name: realm-secret
      mountPath: "/realm/"
      readOnly: true
    - name: theme
      mountPath: /opt/jboss/keycloak/themes/mytheme
    - name: spi
      mountPath: /opt/jboss/keycloak/standalone/deployments

I also have a realm.json file.

Question

What do I need to do with this real.json file prior to installing keycloak? How do I do that ?

like image 816
Anthony Avatar asked Nov 23 '18 16:11

Anthony


1 Answers

The reason is you are referencing a secret named realm-secret in extraVolumes, but that secret with name realm-secret is created neither by the helm chart (named stable/keycloak) nor by you manually.

You can easily find that chart in https://github.com/helm/charts/tree/master/stable/keycloak.

Solution

In values.yaml, the field extraVolume and extraVolumeMount is kept to provide an extra volume and extra volumeMount by user if they need. They will be used in the keycloak pod.

So if you need to provide extraVolumes that will mount a secret, then you have to create that secret all by yourself, so you'll need to create secret realm-secret in the same namespace in which you install/upgrade your chart. And only then install/upgrade the chart.

$ kubectl create secret generic realm-secret --namespace=<chart_namespace> --from-file=path/to/realm.json
like image 67
Shudipta Sharma Avatar answered Nov 19 '22 00:11

Shudipta Sharma