'how to Start keycloak 18 in Https mode in Kubernetes(minikube) Getting error to get the certificate

I'm running a minikube cluster on my local machine And want to deploy keycloak 18 version via Helm chart. But I'm unknown about. How to Add Generated certficates to my Keycloak Container.

Here is my Yaml file for Keycloak. I tried like this but gave Error :

 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) Key material not provided to setup HTTPS. Please configure your keys/certificates or start the server

YAML file

      containers:
        - name: keycloak
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          args: {{ .Values.args }}
          env:
          - name: KEYCLOAK_ADMIN
            value: {{ .Values.cred.User }}
          - name: KEYCLOAK_ADMIN_PASSWORD
            value: {{ .Values.cred.Password }}
          - name: KC_PROXY
            value: "edge"
          - name: KC_HOSTNAME
            value: keycloak.192.168.59.150.nip.io:8443
          - name: KC_HTTPS_CERTIFICATE_FILE
            value: /home/user/keycloak/crt/example.crt
          - name: KC_HTTPS_CERTIFICATE_KEY_FILE
            value: /home/user/keycloak/crt/example.key
          ports:
          - name: http
            containerPort: 8080
          - name: https
            containerPort: 8443
          readinessProbe:
            httpGet:
              path: /realms/master
              port: 8080
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:

Where should I give the Certificates/Keys path to my keycloak Container

MY keycloak Helm structure and i have added all the Certificates in crt directory

keycloak
├── Chart.lock
├── Chart.yaml
├── charts
├── crt
│   ├── example.crt
│   ├── example.csr
│   ├── example.key
│   └── example_public.key
├── templates
│   ├── NOTES.txt
│   ├── _helpers.tpl
│   ├── deployment.yaml
│   ├── hpa.yaml
│   ├── ingress.yaml
│   ├── service.yaml
│   ├── serviceaccount.yaml
│   └── tests
│       └── test-connection.yaml
└── values.yaml


Solution 1:[1]

name: KC_HTTPS_CERTIFICATE_FILE
        value: /home/user/keycloak/crt/example.crt
      - name: KC_HTTPS_CERTIFICATE_KEY_FILE
        value: /home/user/keycloak/crt/example.key

Make sure that the certificat and the key paths are correct. I suggest you copy them inside before. I suggest you to build your own image with docker: [![enter image description here][1]][1]

FROM openjdk:11
COPY . .
ENV KEYCLOAK_ADMIN admin
ENV KEYCLOAK_ADMIN_PASSWORD admin
ENTRYPOINT [ "keycloak-17.0.1/bin/kc.sh","start","--https-certificate- 
file=yourfilecert.pem","--https-certificate-key- 
file=yourkeyfile.key","--hostname=yourhostname"]

After build your image :docker build . -t yourtag:version

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ilboudo kader