A key feature in Artifactory HA is the ability to set an initial cluster size using --set artifactory.node.replicaCount=${CLUSTER_SIZE}
and if needed, to resize the cluster.
Before Scaling
When scaling, you need to explicitly pass the database password if the password is an automatically generated one (this is the default with the enclosed PostgreSQL Helm chart).
To get the current database password use the following.
export DB_PASSWORD=$(kubectl get $(kubectl get secret -o name | grep postgresql) -o jsonpath="{.data.postgresql-password}" | base64 --decode)
Important
Use --set postgresql.postgresqlPassword=${DB_PASSWORD}
with every scale action to prevent a misconfigured cluster.
To Scale Up:
Assuming that you have a cluster with 2 member nodes, and you want to scale up to 3 member nodes (to a total of 4 nodes), use the following.
# Scale to 4 nodes (1 primary and 3 member nodes) helm upgrade --install artifactory-ha --set artifactory.node.replicaCount=3 --set postgresql.postgresqlPassword=${DB_PASSWORD} --namespace artifactory-ha jfrog/artifactory-ha
To Scale Down:
# Scale down to 2 member nodes helm upgrade --install artifactory-ha --set artifactory.node.replicaCount=2 --set postgresql.postgresqlPassword=${DB_PASSWORD} --namespace artifactory-ha jfrog/artifactory-ha
Note
Because Artifactory is running as a Kubernetes Stateful Set, the removal of the node will not remove the persistent volume. You need to explicitly remove it as follows.
# List PVCs kubectl get pvc # Remove the PVC with highest ordinal! # In this example, the highest node ordinal was 2, so need to remove its storage. kubectl delete pvc volume-artifactory-node-2