ZooKeeper

Deploying ZooKeeper in a project

Getting started

To get started with creating ZooKeeper clusters in your project namespace, you first need to deploy the ZooKeeper operator in the workspace where the project exists.

After you deploy the ZooKeeper operator, you can create ZooKeeper Clusters by applying a ZookeeperCluster custom resource on each attached cluster in a project’s namespace.

A Helm chart exists in the ZooKeeper operator repository that can assist with deploying ZooKeeper clusters.

Example deployment

NOTE: If you need to manage these custom resources across all clusters in a project, it is recommended you use Project Deployments which enables you to leverage GitOps to deploy the resources. Otherwise, you will need to create the resources manually in each cluster.

Follow these steps to deploy a ZooKeeper cluster in a project namespace. This procedure results in a running ZooKeeper cluster, ready for use in your project’s namespace.

  1. Set the PROJECT_NAMESPACE environment variable to the name of your project’s namespace:

    export PROJECT_NAMESPACE=<project namespace>
    
  2. Create a ZooKeeper Cluster custom resource in your project namespace

    kubectl apply -f - <<EOF
    apiVersion: zookeeper.pravega.io/v1beta1
    kind: ZookeeperCluster
    metadata:
      name: zookeeper
      namespace: ${PROJECT_NAMESPACE}
    spec:
      replicas: 1
    EOF
    
  3. Check the status of your ZooKeeper cluster using kubectl:

    kubectl get zookeeperclusters -n ${PROJECT_NAMESPACE}
    
    NAME        REPLICAS   READY REPLICAS    VERSION   DESIRED VERSION   INTERNAL ENDPOINT    EXTERNAL ENDPOINT   AGE
    zookeeper   1          1                 0.2.13    0.2.13            10.100.200.18:2181   N/A                 94s
    

Deleting ZooKeeper clusters

Follow these steps to delete the Zookeeper clusters.

  1. View ZookeeperClusters in all namespaces:

    kubectl get zookeeperclusters -A
    
  2. Delete a specific ZookeeperCluster:

    kubectl -n ${PROJECT_NAMESPACE} delete zookeepercluster <name of zookeepercluster>
    

Resources