Resize Artifact Registry storage

Follow these instructions if, during the upgrade process, there is not enough free storage space in the Artifact Registry, which results in operation failures.

Complete the following steps to check storage availability, and resize the Artifact Registry storage, if needed.

Check the storage usage of the Artifact Registry in an admin cluster

You can check the current Artifact Registry storage usage in the admin cluster to determine next steps for storage allocation. Work through the following steps:

  1. Export the kubeconfig file path for the admin cluster Artifact Registry:

    export ADMIN_CLUSTER_KUBECONFIG=KUBECONFIG_FILE_PATH
    

    Replace KUBECONFIG_FILE_PATH with the path to the kubeconfig file in the admin cluster.

  2. Set the existing Artifact Registry pod as an environment variable:

    pod=$(kubectl --kubeconfig $ADMIN_CLUSTER_KUBECONFIG get pods -n harbor-system -l goharbor.io/operator-controller=registry -o name)
    
  3. Print the output for the Artifact Registry storage usage:

    kubectl --kubeconfig $ADMIN_CLUSTER_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
    

Apply the new storage size

You can resize the storage of the Artifact Registry, if necessary. Work through the following steps:

  1. Create a new environment variable and set it to the new persistent volume claim (PVC) storage size:

    STORAGE_SIZE=400G
    
  2. Apply the new storage size to the Artifact Registry:

    kubectl --kubeconfig $ADMIN_CLUSTER_KUBECONFIG patch Persistentvolumeclaim/harbor-registry \
        -n harbor-system --type=merge \
        -p '{"spec": {"resources": {"requests": {"storage": "'$STORAGE_SIZE'"}}}}'
    
  3. Restart the Artifact Registry pod to implement the new storage size update:

    kubectl --kubeconfig $ADMIN_CLUSTER_KUBECONFIG rollout restart deployment \
        -n harbor-system harbor-harbor-harbor-registry
    
  4. Verify your usage amount and capacity increase by checking the Artifact Registry.