Skip to content

Apache Zookeeper Kubernetes Operator built with Kubebuilder

License

Notifications You must be signed in to change notification settings

monimesl/zookeeper-operator

Repository files navigation

Language Go Report Card Actions Status

Apache Zookeeper Operator

Status: alpha

Simplify Zookeeper installation and management in kubernetes using CRDs

Overview

The Zookeeper Operator enable native Kubernetes deployment and management of Apache Zookeeper Ensemble. To set up the cluster, the operator uses Zookeeper Dynamic Configuration which is supported by version 3.5+ . View versions to see the Zookeeper versions we provide support for. For now, version 3.6.3_ is used as the installed version.

Prerequisites

The operator needs a kubernetes cluster with a version >= v1.16.0 . If you're using Helm to install the operator, your helm version must be >= 3.0.0 .

Installation

The operator can be installed and upgrade by using our helm chart or directly using the manifest file. We however do recommend using the helm chart .

Via Helm

First you need to add the chart's repository to your repo list:

helm repo add monimesl https://monimesl.github.io/helm-charts
helm repo update

Create the operator namespace; we're doing this because Helm 3 no longer automatically create namespace.

kubectl create namespace zookeeper-operator

Now install the chart in the created namespace:

helm install zookeeper-operator monimesl/zookeeper-operator -n zookeeper-operator

If you don't have Helm or its required version, or you just want to try the operator quickly, this option is then ideal. We provide a manifest file per operator version. The below command will install the latest version.

Install the latest tag version:

 kubectl apply -f https://raw.githubusercontent.com/monimesl/zookeeper-operator/main/deployments/manifest.yaml

Or install the other tagged version you want by using the url below; replace <tag-here> with the tag.

 kubectl apply -f https://raw.githubusercontent.com/monimesl/zookeeper-operator/<tag-here>/deployments/manifest.yaml

Mind you, the command above will install a CRD and create a ClusterRole; so the user issuing the command must have cluster-admin privileges.

Confirm Installation

Before continuing, ensure the operator pod is ready

kubectl wait --for=condition=ready --timeout=60s pod -l app.kubernetes.io/name=zookeeper-operator -n zookeeper-operator

When it gets ready, you will see something like this:

pod/zookeeper-operator-7975d7d66b-nh2tw condition met

If your wait timedout, try another wait.

Usage

Creating the simplest Zookeeper ensemble

Apply the following yaml to create the ensemble with 3 nodes.

apiVersion: zookeeper.monime.sl/v1alpha1
kind: ZookeeperCluster
metadata:
  name: cluster-1
  namespace: zookeeper
spec:
  size: 3
  persistence:
    reclaimPolicy: "Delete"

Scale up the ensemble from 3 to 5 nodes:

Apply the following yaml to update the cluster-1 ensemble.

apiVersion: zookeeper.monime.sl/v1alpha1
kind: ZookeeperCluster
metadata:
  name: cluster-1
  namespace: zookeeper
spec:
  size: 5 # scale out
  persistence:
    reclaimPolicy: "Delete"