automation-suite
2023.10
false
重要 :
新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

Linux 版 Automation Suite 安装指南

上次更新日期 2026年1月16日

如何从注册表 Pod 中清理未使用的 Docker 映像

注意:
我们会在注册表清理中执行垃圾收集。注册表运行时,不应对其执行任何写入操作。注册表种子设定(写入操作)发生在 Automation Suite 的安装和升级期间,因此在这些过程正在进行时,不得执行清理。

在某些情况下,即使运行注册表清理命令,也无法有效地从所有注册表 Pod 中清除未使用的 Docker 映像:

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

要删除其余的 Docker 映像,您必须运行以下脚本:

#!/bin/bash

# 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"

    # 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/bash

# 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"

    # 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."

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo
信任与安全
© 2005-2026 UiPath。保留所有权利。