apiVersion: v1
kind: ReplicationController
metadata:
  name: zabbix-server
  labels:
    app: zabbix
    tier: server
    environment: dev
  namespace: zabbix
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: zabbix-server
        app: zabbix
    spec:
      containers:
        - name: zabbix-server
          image: zabbix/zabbix-server-mysql:alpine-5.0-latest
          imagePullPolicy: Always
          ports:
          - containerPort: 10051
            protocol: TCP
            name: zabbix-server
          env:
          - name: MYSQL_USER
            valueFrom:
             secretKeyRef:
              name: db-secret
              key: db-zbx-user
          - name: MYSQL_PASSWORD
            valueFrom:
             secretKeyRef:
              name: db-secret
              key: db-zbx-pass
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
             secretKeyRef:
              name: db-secret
              key: db-root-pass
          - name: MYSQL_DATABASE
            value: "zabbix"
          volumeMounts:
          - name: alertscripts
            mountPath: /usr/lib/zabbix/alertscripts
          volumeMounts:
          - name: externalscripts
            mountPath: /usr/lib/zabbix/externalscripts
          volumeMounts:
          - name: modules
            mountPath: /var/lib/zabbix/modules
          volumeMounts:
          - name: enc
            mountPath: /var/lib/zabbix/enc
          volumeMounts:
          - name: snmptraps
            mountPath: /var/lib/zabbix/snmptraps
          volumeMounts:
          - name: mibs
            mountPath: /var/lib/zabbix/mibs
          volumeMounts:
          - name: export
            mountPath: /var/lib/zabbix/export
      volumes:
       - hostPath:
          path: /zbx_env/usr/lib/zabbix/alertscripts
         name: alertscripts
       - hostPath:
          path: /zbx_env/usr/lib/zabbix/externalscripts
         name: externalscripts
       - hostPath:
          path: /zbx_env/var/lib/zabbix/modules
         name: modules
       - hostPath:
          path: /zbx_env/var/lib/zabbix/enc
         name: enc
       - hostPath:
          path: /zbx_env/var/lib/zabbix/snmptraps
         name: snmptraps
       - hostPath:
          path: /zbx_env/var/lib/zabbix/mibs
         name: mibs
       - hostPath:
          path: /zbx_env/var/lib/zabbix/export
         name: export