Ensure that all pods from the Artifactory HA chart serve as primary. Set the flag --set artifactory.primary.replicaCount=${CLUSTER_SIZE}
instead of --set artifactory.node.replicaCount=${CLUSTER_SIZE}
.
For example, in a scenario with 4 pods, implement the following flag: --set artifactory.primary.replicaCount=4
.
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 command.
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.primary.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.primary.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