> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/latest/installation/scale-tposs.md).

# Scaling TPOSS

This document describes how to change the number of TPOSS instances. For the placeholders used in the commands below, see the [Placeholders](https://docs.cennso.com/components/tposs/latest/installation/installation.md#placeholders) section of the installation document.

## Scale TPOSS

TPOSS runs as a Kubernetes StatefulSet. The **replicaCount** configuration option sets the number of the TPOSS instances. To change the number of TPOSS replicas, run the following command:

```bash
helm upgrade {HELM_RELEASE_NAME} oci://{REGISTRY_HOST}/charts/tposs --version {CHART_VERSION} -f values.yaml --set replicaCount={NEW_NUMBER_OF_TPOSS_REPLICAS} -n {NAMESPACE}
```

> [!CAUTION]
> Do not scale the TPOSS StatefulSet with the `kubectl scale` command. Besides the StatefulSet, the chart renders one Kubernetes Service per replica, which exposes the [EPMD](https://www.erlang.org/doc/apps/erts/epmd_cmd.html), the TPOSS HTTP API, and the Diameter ports of the given pod. A pod added with `kubectl scale` has no such Service, and the next `helm upgrade` resets the number of replicas back to the **replicaCount** value.

When you scale up, the new instances join the Erlang cluster automatically.

When you scale down, Kubernetes removes the pods with the highest ordinal number first. The removed instance stops accepting new requests, finishes the requests it already handles, and leaves the Erlang cluster.

Kubernetes keeps the `PersistentVolumeClaim` of a removed pod, for example `tposs-data-{HELM_RELEASE_NAME}-tposs-2`. A later scale up reuses this claim.

For the recommended number of replicas and the configuration options needed for the TPOSS cluster, see the [High availability](https://docs.cennso.com/components/tposs/latest/use-cases/availability-cases/tposs-ha.md) document. To check the result of the scaling, use the commands from the [Verify the deployment](https://docs.cennso.com/components/tposs/latest/installation/installation.md#verify-the-deployment) section.
