I'm new in Kubernetes and helm-charts, and trying to make Keycloak save data in Postgres and not in H2(as he do it by default). Postgres will be created by separate helm chart. First I creating Postgres by command:
helm install --name=postgres-keycloak stable/postgresql
Then I look at new Postgres service "Internal endpoints" parameter. And trying to add this parameters to helm-chart of Keycloak. Here is values.yaml part:
Service:
Name: keycloak-new
Port: 8080
Type: ClusterIP
postgresAddr: postgres-keycloak-postgresql
postgresPort: 5432
Then in templates folder I add to service.yaml:
env:
- name: POSTGRES_PORT_5432_TCP_ADDR
value: "{{ .Values.Service.postgresAddr }}"
- name: POSTGRES_PORT_5432_TCP_PORT
value: "{{ .Values.Service.postgresPort }}"
Then I create keyclaok package by "helm package keycloak" command, and install:
helm install --debug --name=keycloak-new keycloak-0.1.0.tgz
It fails with error:
[debug] Created tunnel using local port: '49927'
[debug] SERVER: "localhost:49927"
[debug] Original chart version: ""
[debug] CHART PATH: /Users/user/helm-charts/keycloak-0.1.0.tgz
Error: error validating "": error validating data: found invalid field env for v1.ServiceSpec
Who knows what I did wrong? Or what I miss?
Your env should be declared as a part of PodSpec (which you can find in objects like Pod, ReplicaSet, Deployment, etc.) not in a Service which defines only a sort of internal load-balancer/router for your traffic.