Cluster Scaling
This tasks shows you how to perform a gracefull cluster scale up and scale down.
Before you begin
- Setup NiFiKop by following the instructions in the Installation guide.
 - Deploy the Simple NiFi sample cluster.
 - Review the Node references doc.
 
About this task
The Simple NiFi example consists of a three nodes NiFi cluster. A node decommission must follow a strict procedure, described in the NiFi documentation :
- Disconnect the node
 - Once disconnect completes, offload the node.
 - Once offload completes, delete the node.
 - Once the delete request has finished, stop/remove the NiFi service on the host.
 
For the moment, we have implemented it as follows in the operator :
- Disconnect the node
 - Once disconnect completes, offload the node.
 - Once offload completes, delete the pod.
 - Once the pod deletion completes, delete the node.
 - Once the delete request has finished, remove the node from the NifiCluster status.
 
In addition, we have a regular check that ensure that all nodes have been removed.
In this task, you will first perform a scale up, in adding an new node. Then, you will remove another node that the one created, and observe the decommission's steps.
Scale up : Add a new node
For this task, we will simply add a node with the same configuration than the other ones, if you want to know more about how to add a node with an other configuration let's have a look to the Node configuration documentation page.
- Add and run a dataflow as the example :
 

- Add a new node to the list of 
NifiCluster.Spec.Nodesfield, by following the Node object definition documentation: 
important
Note : The Node.Id field must be unique in the NifiCluster.Spec.Nodes list.
- Apply the new 
NifiClusterconfiguration : 
- You should now have the following resources into kubernetes :
 
And if you go on the NiFi UI, in the cluster administration page :

- You now have data on the new node :
 

Scaledown : Gracefully remove node
For this task, we will simply remove a node and look at that the decommission's steps.
- Remove the node from the list of 
NifiCluster.Spec.Nodesfield : 
- Apply the new 
NifiClusterconfiguration : 
- You can follow the node's action step status in the 
NifiCluster.Statusdescription : 
tip
The list of decommision's step and their corresponding value for the Nifi Cluster.Status.Node State.Graceful ActionState.ActionStep field is described into the Node State page
- Once the scaledown successfully performed, you should have the data offloaded on the other nodes, and the node state removed from the 
NifiCluster.Status.NodesStatelist : 
warning
Keep in mind that the NifiCluster.Spec.nifiClusterTaskSpec.retryDurationMinutes should be long enough to perform the whole procedure, or you will have some rollback and retry loop.