Unable to add environment variable to pravega zookeeper operator cluster kubernetes pods

12/3/2020

I am trying to create an environment variable in the 3 zookeeper kubernetes pods(running 1 zk operator with 3 zk pods in a cluster), we do have a zookeeper operator 0.2.7 version. The goal is to setup SASL/SSL authentication, and for that reason I would like to have environment variable to set in 3 zookeeper pods cluster. KAFKA_OPTS="-Djava.security.auth.login.config=etc/kafka/zookeeper_jaas.conf" This is the manifest reading env variable from configmap zk-configmap-sasl :

apiVersion: zookeeper.pravega.io/v1beta1
kind: ZookeeperCluster
metadata:
name: zookeeper
namespace: kafka
spec:
env:

name : KAFKA_OPTS
valueFrom:
configMapKeyRef:
name: zk-configmap-sasl
key: jaas
image:
repository: 123456789.dkr.ecr.eu-west-1.amazonaws.com/external/zookeeper
tag: 0.2.7
persistence:
reclaimPolicy: Delete
spec:
resources:
requests:
storage: 20Gi
storageClassName: encrypted-gp2
replicas: 3

When I do kubectl apply, it says successfully configured. However, I dont see the env variable configured in the statefulset for zk cluster. I am having same problem provisioning volumes. Kubectl apply says configured, but no changes on STS

-- Bhushan Patil
apache-kafka
apache-zookeeper
kubernetes

1 Answer

3/8/2021

Environment variables can be set on the pods in a ZK cluster by specifying pod.env values in the ZK chart's values.yml file as seen here: https://github.com/pravega/zookeeper-operator/blob/v0.2.9/charts/zookeeper/values.yaml#L19

-- derekm
Source: StackOverflow