helm-zabbix
helm-zabbix copied to clipboard
[cetic/zabbix] ENV vars not being passed to pods
When supplying non default zabbix db host parameters. the zabbix-server pod and zabbix-web does not get the ENV from the helm values or from the secret.
**version.BuildInfo{Version:"v3.7.2", GitCommit:"663a896f4a815053445eec4153677ddc24a0a361", GitTreeState:"clean", GoVersion:"go1.16.10"}
Provider: RKE1 Kubernetes Version: v1.21.6
**In a working setup , The ENV vars are passed to the pods **:
**Set the zabbix db_host to a non standard value : HELM DEBUG:
helm install zabbix cetic/zabbix --dependency-update -n zabbix -f zabbix6_values_new.yml --debug |grep -i host install.go:178: [debug] Original chart version: "" install.go:199: [debug] CHART PATH: /home/lee.lilleorg/.cache/helm/repository/zabbix-3.1.1.tgz
client.go:128: [debug] creating 10 resource(s) db_server_host: zabbix-postgresql.zabbix.svc.cluster.local hosts:
- host: chart-example.local hostName: chart-example.local hostName: chart-example.local ZBX_SERVER_HOST: 127.0.0.1 hostIP: 0.0.0.0 hostPort: false db_server_host: zabbix-postgresql.zabbix.svc.cluster.local hosts:
- host: chart-example.local hostName: chart-example.local hostName: chart-example.local ZBX_SERVER_HOST: 127.0.0.1 ZBX_HOSTNAME: zabbix-proxy ZBX_SERVER_HOST: zabbix-zabbix-server hostIP: 0.0.0.0 hostPort: false topologyKey: kubernetes.io/hostname - name: DB_SERVER_HOST value: "hostname" - name: ZBX_HOSTNAME - name: ZBX_SERVER_HOST topologyKey: kubernetes.io/hostname - name: DB_SERVER_HOST topologyKey: kubernetes.io/hostname - name: DB_SERVER_HOST - name: PGHOST
I am in vacation right now with a very bad connection, but I will look into this today or tomorrow.
Thanks
Christian
I have checked your values.yaml file.
I believe your problem is just that you have still set use_unified_secret: true
which disables all the specifically set settings. Please try with use_unified_secret: false
. Also, You have set both postgres_password_secret
/ postgres_password_secret_key
and postgres_password
. Please not that only one of both should be set, as otherwise postgres_password
has no effect.
I have revised my vakues file , setting the use_unified_secret to false,
I have set the postgres_password and the parameters per setup (Server/Web/Database)
I have commented out the postgres_password_secret_key
The Pods are still getting the hostname from ENV with a helm install zabbix cetic/zabbix -n zabbix -f zabbix6_values_new.yml
Would you be able to provide a pared down sample yaml with the db and zabbix web or server to see the hostnames being set correctly.
are you also getting the same result when the var: db_server_host: "my_zabbix-postgresql.zabbix.svc.cluster.local"
Thanks
I see your problem:
You have not disabled the internal postgresql component: postgresql.enabled: true
in values.yaml. The logic to template the env vars for DB access is to always set the host name of the database to use for all components to the postgresql component deployed within this chart, if this component is enabled, which from my point of view makes a lot of sense. I have just tested, and it works as expected.
I tested it and realized i did have the postgresql section not enabled (d'oh)
my issue is that I want to use the hostname of the db that the helmchart creates to set : zabbix-postgresql.zabbix.svc.cluster.local and that the rest of the nodes also refer to the db pod as zabbix-postgresql.zabbix.svc.cluster.local
were you able to test with the db_hostname set to zabbix-postgresql.zabbix.svc.cluster.local where my namespace is zabbix ?
The only change to the values_new is postgres enabled=true
running connectivity tests:
kubectl get svc -n zabbix
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
zabbix-postgresql ClusterIP 10.43.80.152
kubectl get po -n zabbix NAME READY STATUS RESTARTS AGE zabbix-postgresql-0 1/1 Running 0 11m zabbix-zabbix-server-667ffcdc7-dhfgf 2/2 Running 0 11m zabbix-zabbix-web-5d6bbdc8b9-jbtqm 0/1 Running 5 11m zabbix-zabbix-webservice-6f688cf7f-2sqdj 1/1 Running 0 11m
its still being set as
THanks for looking into this
I was able to set the ENV in the extraenv sections and its working.
extraEnv: - name: "ENABLE_TIMESCALED" value: "true" - name: "DB_SERVER_HOST" value: "zabbix-postgresql.zabbix.svc.cluster.local"
extraEnv: - name: DB_SERVER_HOST value: zabbix-postgresql.zabbix.svc.cluster.local
Hi!
Back from vacation. Sorry for the delay, but the last days at the beach were just too busy to answer here :-)
my issue is that I want to use the hostname of the db that the helmchart creates to set : zabbix-postgresql.zabbix.svc.cluster.local and that the rest of the nodes also refer to the db pod as zabbix-postgresql.zabbix.svc.cluster.local
OK, I understand what you try to achieve now. You want the "integrated" postgresql DB to be deployed and used, BUT you want to refer to it under a different name than just the default one used by the helm chart (including the FQDN instead of just using the service name). THIS has never been designed to be used like this, but your solution of providing extra env vars would have been a workaround that I had asked you to try also.
Could you please elaborate on WHY you want this? I mean, it is a kubernetes standard that inside of a namespace you will be able to address services by just their names, without the need to supply the entire domain name.
Help me understand the use case please.
were you able to test with the db_hostname set to zabbix-postgresql.zabbix.svc.cluster.local where my namespace is zabbix ?
Yes I did, but as described above, with the postgresq.enabled=false. This way, the helm chart supposes you "bring your own database" and want to connect to it, instead of deploying one itself.
Thanks
Christian
Hi guys!
This project is no longer supported. The code was migrated for https://github.com/zabbix-community/helm-zabbix We can continue the conversation in the new repository.