helm-charts

zookeeper

A Helm chart for Confluent Zookeeper on Kubernetes

Introduction

This chart bootstraps an ensemble Apache Zookeeper Servers using the Confluent stable version.

ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services, used as a backend by distributed applications.

Developing Environment

component version
Podman v4.3.1
Minikube v1.28.0
Kubernetes v1.25.3
Helm v3.10.2
Confluent Platform v7.3.0
Zookeeper v3.6.3

Installing the Chart

Add the chart repository, if not done before:

helm repo add rhcharts https://ricardo-aires.github.io/helm-charts/

To install the chart with the release name zkp:

$ helm upgrade --install zkp rhcharts/zookeeper
Release "zkp" does not exist. Installing it now.
NAME: zkp
LAST DEPLOYED: Mon Nov 21 15:49:17 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
** Please be patient while the zookeeper chart is being deployed in release zkp **

This chart bootstraps an ensemble Apache Zookeeper Servers made of "3" servers using the Confluent stable version that can be accessed from within your cluster:

    zkp-zookeeper-headless.default:2181

To connect to your ZooKeeper server run the following commands:

    $ kubectl exec -it -n default zkp-zookeeper-0 -- zookeeper-shell zkp-zookeeper-headless.default:2181

More info:
https://ricardo-aires.github.io/helm-charts/charts/zookeeper/
$

This command deploy ZooKeeper on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.

The chart will create the next resources:

Zookeeper

  1. A PodDisruptionBudget to ensure service availability during planned maintenance.
  2. A Headless Service to control the network domain for the ZooKeeper processes and to expose the AdminServer.
  3. A StatefulSet which contains 3 Zookeeper Pods, by default.

One can run the:

This chart uses the srvr command of the Zookeeper Four Letter Words to check that every Zookeeper Server is responding.

To uninstall the zkp deployment run:

helm uninstall zkp

The command removes all the Kubernetes components associated with the chart and deletes the release.

Keep in mind that the PersistentVolumeClaims are in retain.

Parameters

You can specify each parameter using the --set key=value[,key=value] argument to helm install.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

helm upgrade --install zkp -f my-values.yaml rhcharts/zookeeper

A default values.yaml is available and should be checked for more advanced usage.

Image

By default the confluentinc/cp-zookeeper is in use.

Parameter Description Default
image.registry Registry used to distribute the Docker Image. docker.io
image.repository Docker Image of Confluent Zookeeper. confluentinc/cp-zookeeper
image.tag Docker Image Tag of Confluent Zookeeper. 7.3.0

One can easily change the image.tag to use another version. When using a local/proxy docker registry we must change image.registry as well.

Zookeeper Ensemble

The configuration parameters in this section control the resources requested and utilized by the zookeeper chart.

Parameter Description Default
replicaCount The number of ZooKeeper servers. 3

A minimum of three servers are required for a fault tolerant clustered setup, and it is strongly recommended that you have an odd number of servers, because Zookeeper requires a majority.

The value for the PodDisruptionBudget is calculated automatically from the given replicaCount.

Confluent Zookeeper Configuration

The next configuration related to Zookeeper are available:

Parameter Description Default
tickTime The length of a single tick, which is the basic time unit used by ZooKeeper, as measured in milliseconds. 2000
initLimit Amount of time, in ticks (see tickTime), to allow followers to connect and sync to a leader. 10
syncLimit Amount of time, in ticks (see tickTime), to allow followers to sync with ZooKeeper. 5
maxClientCnxns Limits the number of concurrent connections that a single client may make to a single member of the ZooKeeper ensemble. 60
autopurge.purgeInterval The time interval in hours for which the purge task has to be triggered. 24
autopurge.snapRetainCount umber of most recent snapshots and the corresponding transaction logs in the dataDir and dataLogDir to keep. 3
quorumListenOnAllIPs When set to true the ZooKeeper server will listen for connections from its peers on all available IP addresses true
maxSessionTimeout The maximum session timeout in milliseconds that the server will allow the client to negotiate. 40000
adminEnableServer Flag for the AdminServer true
log4jRootLogLevel Log level of ZooKeeper server INFO

More information can be found in the Apache Zookeeper Documentation and in the Confluent Documentation.

Ports used by Zookeeper

ZooKeeper default ports:

Parameter Description Default
port.peers The port on which the ZooKeeper servers listen for requests from other servers in the ensemble. 2888
port.leader The port on which the ZooKeeper servers perform leader election. 3888
port.client The port to listen for client connections; that is, the port that clients attempt to connect to. 2181

Since 3.5.0 we may also set the AdminServer which by default listens in the 8080 port but can be changed by setting the port.admin in the AdminServer configuration.

Enable Kerberos

This chart is prepared to enable Kerberos authentication in Zookeeper

Parameter Description Default
kerberos.enabled Boolean to control if Kerberos is enabled. false
kerberos.krb5Conf Name of the ConfigMap that stores the krb5.conf, Kerberos Configuration file nil¹
kerberos.keyTabSecret Name of the Secret that stores the Keytab nil¹
kerberos.jaasConf Name of the ConfigMap that stores the JAAS configuration files per host. nil¹

¹ When kerberos.enabled these parameters are required, and the ConfigMap and Secret need to exist before.

Data Persistence

The ZooKeeper server continually saves znode snapshot files in a Data Directory to enable you to recover data, transactional logs in this deployment are store in a separated directory.

Parameter Description Default
data.storageClass Valid options: nil, "-", or storage class name. nil
data.storageSize Size for data dir. 1Gi

This will allow the creation of two Persistent Volume using a specific Storage Class and the same size for both.

Resources for Containers

Regarding the management of Resources for Containers the next defaults regarding resources and limits are set:

Parameter Description Default
resources.limits.cpu a container cannot use more CPU than the configured limit 200m
resources.limits.memory a container cannot use more Memory than the configured limit 650Mi
resources.requests.cpu a container is guaranteed to be allocated as much CPU as it requests 100m
resources.requests.memory a container is guaranteed to be allocated as much Memory as it requests 320Mi

In terms of the JVM the next default is set:

Parameter Description Default
heapOpts The JVM Heap Options for Zookeeper Server. "-XX:MaxRAMPercentage=75.0 -XX:InitialRAMPercentage=50.0"

Advance Configuration

Check the values.yaml for more advance configuration such as: