How to check S3 bucket being used and its size for the Openshift-image-registry in ROSA

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Service on AWS (ROSA)

Issue

  • Which Amazon S3 bucket is used to store images
  • What is a disk usage of OpenShift Image Registry on Amazon S3

Resolution

  • By default images are stored in Amazon S3 according to the official ROSA documentation.

  • Identify which bucket is used for image-registery

$ oc get deployment/image-registry -o yaml -n openshift-image-registry

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "3"
    imageregistry.operator.openshift.io/checksum: sha256:a31a13efbd4484a6dbc9bdca643fa286a9ad8515af80e5386d9a8aa851cfeeb7
    operator.openshift.io/spec-hash: e0e64343b2c1e37bdb57325a721ecef2604d4e159da9389f9d4a10b2eb41b49c
    release.openshift.io/version: 4.13.1
  creationTimestamp: "2023-06-11T02:04:48Z"
  generation: 3
  labels:
    docker-registry: default
  name: image-registry
  namespace: openshift-image-registry

.......output omitted........ 

      containers:
      - command:
        - /bin/sh
        - -c
        - mkdir -p /etc/pki/ca-trust/extracted/edk2 /etc/pki/ca-trust/extracted/java
          /etc/pki/ca-trust/extracted/openssl /etc/pki/ca-trust/extracted/pem && update-ca-trust
          extract && exec /usr/bin/dockerregistry
        env:
        - name: REGISTRY_STORAGE
          value: s3                                                                    
        - name: REGISTRY_STORAGE_S3_BUCKET                                              <------ storage class
          value: bucketname-xxxxx-image-registry-ap-southeast-2-cmblswywsfioepxufj      <------ bucket location
        - name: REGISTRY_STORAGE_S3_REGION
          value: ap-southeast-2


  • Identify the size of the used disk space
$  aws s3 ls --summarize --human-readable --recursive s3://bucketname-xxxxx-image-registry-ap-southeast-2-cmblswywsfioepxufj
....output omitted...

Total Objects: 292
   Total Size: 399.1 MiB

Alternatively navigate to S3 Dashboard and check the size though the dashboard

Root Cause

  • By default ROSA Openshift Image Registry is configured to use Amazon S3 to store images

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments