UiPath Documentation
automation-suite
2023.10
false
Guía de instalación de Automation Suite en Linux
Importante :
La localización de contenidos recién publicados puede tardar entre una y dos semanas en estar disponible.

Cómo limpiar las imágenes de Docker no utilizadas de los pods de registro

Descripción general de la recogida de basura para imágenes de Docker no utilizadas en los pods de registro de Automation Suite, incluidas las restricciones de tiempo en torno a la instalación y la actualización.

Nota:

Realizamos la recolección de elementos no utilizados como parte de la limpieza del registro. No se deben realizar operaciones de escritura en el registro mientras se está ejecutando. La propagación del registro (una operación de escritura) se produce durante la instalación y actualización de Automation Suite, por lo que la limpieza no debe realizarse mientras estos procedimientos están en curso.

En determinadas situaciones, las imágenes de Docker no utilizadas no se borran de forma efectiva de todos los pods de registro, incluso después de ejecutar el comando de limpieza del registro:

./bin/uipathctl registry cleanup --manifest versions/docker-images.json
./bin/uipathctl registry cleanup --manifest versions/docker-images.json

Para eliminar las imágenes restantes de Docker, debes ejecutar el siguiente script:

#!/bin/bas

## Set the namespace if necessary
NAMESPACE="docker-registry"  

# Get list of docker-registry StatefulSet pods
PODS=$(kubectl get pods -n $NAMESPACE -l app=docker-registry -o jsonpath='{.items[*].metadata.name}')

# Modify the docker-registry service selector to include traffic: allowed
echo "Modifying docker-registry service selector..."
kubectl patch svc docker-registry -n $NAMESPACE --type='json' -p='[{"op": "add", "path": "/spec/selector/traffic", "value": "allowed"}]'

# Loop through each registry pod one at a time
for POD in $PODS; do
    echo "Processing pod: $POD"

    # Add label traffic=allowed to the current pod
    kubectl label pod $POD -n $NAMESPACE traffic=allowed --overwrite
    echo "Label traffic=allowed added to $POD"

    # Sleep is needed to allow the Kubernetes endpoint controller to properly
    # register the newly labelled pod as a healthy upstream target
    sleep 60

    # Run the registry cleanup command
    echo "Running registry cleanup on $POD..."
    ./bin/uipathctl registry cleanup --manifest versions/docker-images.json

    # Remove label traffic=allowed from the pod
    kubectl label pod $POD -n $NAMESPACE traffic-
    echo "Label traffic=allowed removed from $POD"

    echo "Completed cleanup for $POD"
done

# Revert the docker-registry service selector modification
echo "Reverting docker-registry service selector..."
kubectl patch svc docker-registry -n $NAMESPACE --type='json' -p='[{"op": "remove", "path": "/spec/selector/traffic"}]'

echo "Cleanup process completed for all registry pods."
#!/bin/bas

## Set the namespace if necessary
NAMESPACE="docker-registry"  

# Get list of docker-registry StatefulSet pods
PODS=$(kubectl get pods -n $NAMESPACE -l app=docker-registry -o jsonpath='{.items[*].metadata.name}')

# Modify the docker-registry service selector to include traffic: allowed
echo "Modifying docker-registry service selector..."
kubectl patch svc docker-registry -n $NAMESPACE --type='json' -p='[{"op": "add", "path": "/spec/selector/traffic", "value": "allowed"}]'

# Loop through each registry pod one at a time
for POD in $PODS; do
    echo "Processing pod: $POD"

    # Add label traffic=allowed to the current pod
    kubectl label pod $POD -n $NAMESPACE traffic=allowed --overwrite
    echo "Label traffic=allowed added to $POD"

    # Sleep is needed to allow the Kubernetes endpoint controller to properly
    # register the newly labelled pod as a healthy upstream target
    sleep 60

    # Run the registry cleanup command
    echo "Running registry cleanup on $POD..."
    ./bin/uipathctl registry cleanup --manifest versions/docker-images.json

    # Remove label traffic=allowed from the pod
    kubectl label pod $POD -n $NAMESPACE traffic-
    echo "Label traffic=allowed removed from $POD"

    echo "Completed cleanup for $POD"
done

# Revert the docker-registry service selector modification
echo "Reverting docker-registry service selector..."
kubectl patch svc docker-registry -n $NAMESPACE --type='json' -p='[{"op": "remove", "path": "/spec/selector/traffic"}]'

echo "Cleanup process completed for all registry pods."

¿Te ha resultado útil esta página?

Conectar

¿Necesita ayuda? Soporte(opens in new window)

¿Quiere aprender? UiPath Academy(opens in new window)

¿Tiene alguna pregunta? Foro de UiPath(opens in new window)

Manténgase actualizado