Stopping and starting Event Streams

You can stop or shut down your Event Streams instance if required. You might want to do this in cases of hardware maintenance or during scheduled power outages.

Use the following instructions to gracefully shut down your Event Streams instance. The instance can be started again following the starting up Event Streams instructions.

Stopping Event Streams

To shut down your cluster gracefully, follow these steps:

  1. Enable StrimziPodSetOnlyReconciliation mode
  2. Scale down components
  3. Uninstall the operator

Enabling StrimziPodSetOnlyReconciliation mode in Event Streams operator

Running the operator in this mode ensures that your Event Streams instance is no longer managed by the EventStreams operator. However, the operator still continues to reconcile the StrimziPodSets resources, which can be used to scale down Kafka and Zookeeper pods.

Using the Kubernetes command-line tool (kubectl)

  1. To enable the StrimziPodSetOnlyReconciliation mode, follow these steps:

    Note: This command requires the yq YAML parsing and editing tool.

    • If you are running on the OpenShift Container Platform, run the following command to update the ClusterServiceVersion of the EventStreams operator:

      kubectl get csv -n <namespace> ibm-eventstreams.v<operator_version> -oyaml | yq e "(.spec.install.spec.deployments[0].spec.template.spec.containers[0].env[] | select(.name==\"STRIMZI_POD_SET_RECONCILIATION_ONLY\")) .value=\"true\"" | kubectl apply -f -
      
    • If you are running on other Kubernetes platforms, run the following command to update the deployment resource of the EventStreams operator:

      kubectl get deploy -n <namespace> eventstreams-cluster-operator -oyaml | yq e "(.spec.template.spec.containers[0].env[] | select(.name==\"STRIMZI_POD_SET_RECONCILIATION_ONLY\")) .value=\"true\"" | kubectl apply -f -
      

    Where <namespace> is the namespace your EventStreams operator is installed in and <operator_version> is the version of the operator that is installed.

  2. Wait for the operator pod to reconcile. This is indicated by the Running state. You can watch the progress by running the following command:

    kubectl get pods -n <namespace> --watch
    

    Where <namespace> is the namespace your EventStreams operator is installed in.

Using the OpenShift Container Platform web console

  1. Log in to the OpenShift Container Platform web console using your login credentials.
  2. Expand the Operators dropdown and select Installed Operators to open the Installed Operators page.
  3. Expand the Project dropdown and select the project the instance is installed in. Click the operator called IBM Event Streams managing the project.
  4. Navigate to the ClusterServiceVersion yaml of the EventStreams operator.
  5. Set the following environment variable under spec.install.spec.deployments[0].spec.template.spec.containers[0].env[] to true:

    -  name: STRIMZI_POD_SET_RECONCILIATION_ONLY
       value: 'true'
    
  6. Wait for all Event Streams pods to reconcile. This is indicated by the Running state. You can watch the progress by running the following command:

    kubectl get pods -n <namespace> --watch
    

    Where <namespace> is the namespace your EventStreams operator is installed in.

Scale down components

After starting the operator in StrimziPodSetOnlyReconciliation mode, you can safely scale down all components to 0 replicas, ensuring no pods are running.

To do this for all components of type Deployment, run:

kubectl get deployments -n <namespace> -l app.kubernetes.io/instance=<instance-name> -o custom-columns=NAME:.metadata.name,REPLICAS:.spec.replicas --no-headers > deployment.txt && while read -ra deploy; do kubectl -n <namespace> scale --replicas=0 deployment/${deploy}; done < deployment.txt

Where <namespace> is the namespace your Event Streams instance is installed in and <instance-name> is the name of your Event Streams instance.

Note: This saves the state of your deployments to a file called deployment.txt in the current working directory.

To scale down all components of type StrimziPodSet, run the following command to delete the spec.pods configuration in the StrimziPodSet resources:

kubectl patch -n <namespace> `kubectl get sps -n <namespace> -o name` --type json -p '[{"op":"replace","path":"/spec/pods","value":[]}]'

Where <namespace> is the namespace your Event Streams instance is installed in.

Uninstall the operator

Select your platform to see the instructions for:

Starting up Event Streams

To scale the Event Streams instance back up to the original state, install the Event Streams operator again following the steps in the installing section.

  1. Install the operator, ensuring it is configured with the same installation mode as used for the previous installation to manage the instances of Event Streams in any namespace or a single namespace.
  2. Wait for the operator to scale all resources back up to their original state. You can watch the progress by running:

    kubectl get pods --watch