dj-wasabi / helm-zabbix

HELM package for deploying Zabbix to Kubernetes
MIT License
8 stars 5 forks source link

Zabbix and Postgres - Won't start #14

Open rsliotta opened 3 years ago

rsliotta commented 3 years ago

Hello.

I am new to zabbix. I setup a postgres db and that is working. I cannot get it to start. in a crashbackloop and there are only two lines about the postgres user and then it dies.

I also tried to create the user and database to see if that helps. Nothing. Any ideas?

Log:

[B:cities:zabbix] liottar:/Users/liottar/projects/262life/262helm3/zabbix$ kl zabbix-server-0 -c zabbix-server Preparing Zabbix server Using POSTGRES_USER variable from ENV **** Both variables POSTGRES_PASSWORD and POSTGRES_PASSWORD_FILE are set (but are exclusive)

dj-wasabi commented 3 years ago

Hi @rsliotta

Can you provide some more information. How did you deploy the Postgres, what are the configuration values you have used for the Zabbix HELM Chart? If I have this, I can try to replicate it and work towards an solution.

rsliotta commented 3 years ago
Values.yaml:

# Default values for helm-zabbix.

image:
  pullPolicy: IfNotPresent

ingress:
  enabled: false
  annotations: {}
  hosts:
  - host: www.example.com
    secretName: www.example.com
    paths:
    - /
  # tls:
  #   - hosts:
  #     - www.example.com
  #     secretName: www.example.com

zabbix:
  version: 5.2-latest
  database:
    type: pgsql
    name: zabbix
    host: postgres-zabbix
  namespace: zabbix
  networkPolicy:
    enabled: true

server:
  enabled: true
  database: {}
  securityContext:
    privileged: true
    runAsUser: 1997

  snmptraps:
    enabled: true
  externalIPs: []
  env: {}
  volumes: []
  volumeMounts: []

web:
  enabled: true
  webserver: nginx
  timezone: Europe/Riga
  securityContext:
    privileged: true
    runAsUser: 1997

agent:
  enabled: true
  securityContext:
    privileged: true
    runAsUser: 1997
  server:
    host: ''
  timeout: 10
  startagents: 3
  passiveagent: true
  volumes_host: true
  volumes: []
  volumeMounts: []

Postgres:

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-zabbix-configmap
  namespace: zabbix
  labels:
    app: postgres-zabbix
data:
  POSTGRES_DB: postgresdb
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: duco534
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: postgres-zabbix
  namespace: zabbix
  labels:
    app: postgres-zabbix
spec:
  storageClassName: rook-ceph-block
  capacity:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres-zabbix
  namespace: zabbix
  labels:
    app: postgres-zabbix
spec:
  serviceName: postgres-zabbix
  replicas: 1
  selector:
    matchLabels:
      app: postgres-zabbix
  template:
    metadata:
      labels:
        app: postgres-zabbix
    spec:
      initContainers:
      - command:
        - sh
        - -c
        - rm -rfv /var/lib/postgresql/data/lost+found
        image: busybox
        imagePullPolicy: IfNotPresent
        name: remove-lost-found
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: pv-data
      containers:
      - name: postgres
        image: postgres:12.7
        imagePullPolicy: "IfNotPresent"
        envFrom:
        - configMapRef:
            name: postgres-zabbix-configmap
        ports:
        - containerPort: 5432
          name: postgresqldb
        volumeMounts:
        - name: pv-data
          mountPath: /var/lib/postgresql/data
      volumes:
      - name: pv-data
        persistentVolumeClaim:
          claimName: postgres-zabbix
---
apiVersion: v1
kind: Service
metadata:
  name: postgres-zabbix
  namespace: zabbix
  labels:
    app: postgres-zabbix
spec:
  ports:
  - port: 5432
    name: postgres
  type: ClusterIP
  selector:
    app: postgres-zabbix  
rsliotta commented 3 years ago

Hello.... I found the issue .

This is the error: **** Both variables POSTGRES_PASSWORD and POSTGRES_PASSWORD_FILE are set (but are exclusive)

I edited the deployment and statefulset and removed POSTGRES_PASSWORD_FILE and it started. Don't know if it is working but it's a start.

rsliotta commented 3 years ago

Got logged in and it shows no agent. Looking at the agent logs: 93:20210707:191359.536 active check configuration update from [zabbix-server-0.zabbix.svc:10051] started to fail (cannot resolve [zabbix-server-0.zabbix.svc]) That is NOT a valid hostname. It would more appropriately be. zabbix-server-0.zabbix-server.zabbix.svc

Is there a way to fix that?