This page describes how to check storage availability and resize the Artifact Registry storage if more capacity is required.
Follow these instructions if, during the upgrade process, there is not enough free storage space in the Artifact Registry, which results in operation failures.
Before you begin
To check storage availability and resize the Artifact Registry storage, you must have the necessary identity and access roles:
- System Artifact Registry Debugger: has read and write access to all Harbor resources. Ask your Security Admin to grant you the System Artifact Registry Debugger (
sar-debugger
) cluster role.
Check the storage usage of the Artifact Registry in the org infrastructure cluster
You can check the current Artifact Registry storage usage in the org infrastructure cluster to determine next steps for storage allocation. Work through the following steps:
Export the
kubeconfig
path for the org infrastructure cluster Artifact Registry:export ORG_INFRA_KUBECONFIG=KUBECONFIG_FILE_PATH
Replace
KUBECONFIG_FILE_PATH
with the path to thekubeconfig
file for the org infrastructure cluster.Set the existing Artifact Registry pod as an environment variable:
pod=$(kubectl --kubeconfig $ORG_INFRA_KUBECONFIG get pods -n harbor-system -l goharbor.io/operator-controller=registry -o name)
Print the output for the Artifact Registry storage usage:
kubectl --kubeconfig $ORG_INFRA_KUBECONFIG exec $pod -n harbor-system \ -c registry -- df -h
Find the mounted path
/var/lib/registry
in the output to view the Artifact Registry storage usage. The following example output shows the Artifact Registry storage usage is 40% and there is 85G of free space:Filesystem Size Used Avail Use% Mounted on overlay 484G 43G 441G 9% / tmpfs 64M 0 64M 0% /dev tmpfs 24G 0 24G 0% /sys/fs/cgroup /dev/sda1 484G 43G 441G 9% /storage tmpfs 43G 12K 43G 1% /harbor_cust_cert/ca.crt shm 64M 0 64M 0% /dev/shm tmpfs 43G 4.0K 43G 1% /etc/registry/auth /dev/mapper/3600a09807770457a795d5452356a3345 147G 54G 85G 40% /var/lib/registry tmpfs 24G 0 24G 0% /proc/acpi tmpfs 24G 0 24G 0% /proc/scsi tmpfs 24G 0 24G 0% /sys/firmware
Verify that the
Avail
size for the/var/lib/registry
file system is larger than the size of the image file to be uploaded. If necessary, you can resize this storage by following the steps in the next section.
Apply the new storage size
You can resize the storage of the Artifact Registry, if necessary. Work through the following steps:
Create a new environment variable and set it to the new persistent volume claim (PVC) storage size:
STORAGE_SIZE=400G
Apply the new storage size to the Artifact Registry:
kubectl --kubeconfig $ORG_INFRA_KUBECONFIG patch Persistentvolumeclaim/harbor-registry \ -n harbor-system --type=merge \ -p '{"spec": {"resources": {"requests": {"storage": "'$STORAGE_SIZE'"}}}}'
Restart the Artifact Registry pod to implement the new storage size update:
kubectl --kubeconfig $ORG_INFRA_KUBECONFIG rollout restart deployment \ -n harbor-system harbor-harbor-harbor-registry
Verify your usage amount and capacity increase by checking the Artifact Registry.