This is documented under "Pruning objects" in the okd 3.x docs [1].

[1]
https://docs.okd.io/3.11/admin_guide/pruning_resources.html#pruning-images

On Thu, Jun 13, 2019 at 8:28 AM Alix ander <[email protected]>
wrote:

> Hi all,
>
> i the last days the docker registry on our cluster(3.9) ran out of space.
> The registry the is backed with glusterfs storage. This happened sometime
> in the past so i expanded the volume used by the docker registry
>
>    - heketi-cli volume expand --volume <volume_id> --expand-size <size>
>
>
> I needed to recreate the pvc with the new capacity and rollout the docker 
> registry DeploymentConfig to get it working.
>
>
> This happened again yesterday and I wanted to figure out how to clean up
> the registry instead of expanding it's size. It got 80G huge!
>
> This is how i done that
>
>    - ssh to the master
>
> # Add the system:image-pruner role: The service account used to run the
> registry instances requires additional permissions in order to list some
> resources.
> Get the service account name:
>
>    -     service_account=$(oc get -n default -o
>    
> jsonpath=$'system:serviceaccount:{.metadata.namespace}:{.spec.template.spec.serviceAccountName}\n'
>    dc/docker-registry)
>
> # Add the system:image-pruner cluster role to the service account:
> service_account=$(oc get -n default -o
> jsonpath=$'system:serviceaccount:{.metadata.namespace}:{.spec.template.spec.serviceAccountName}\n'
> dc/docker-registry)
>
>    -   oc adm policy add-cluster-role-to-user system:image-pruner
>    ${service_account}
>
> # select the default project
>
>    - oc project default
>
> # login as registry service account
>
>    - oc login -u system:serviceaccount:default:registry
>
> # check prune dry run
>
>    -  oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m
>
> # run prune
>
>    - oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m
>    --confirm
>
> #login again as admin
>
>    - oc login -u system:admin
>
> The Registry size shrank into 4G ^^
>
> I though i share this with you if you got a similar issue. If any body has
> a better approach or any note on that, I will be happy if you contact me :)
>
> Kind Regards,
> Alix A.
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>


-- 

Adam Kaplan

He/Him

Senior Software Engineer - OpenShift

Red Hat <https://www.redhat.com/>

100 E. Davie St. Raleigh, NC 27601 USA

[email protected]    T: +1-919-754-4843     IM: adambkaplan
<https://www.redhat.com/>
_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to