You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已安装ICP集群私有镜像仓库位置安全迁移方法咨询

Hey there! Let's break down your two ICP private image registry questions clearly, with a step-by-step migration process for your disk space issue:

1. Can you migrate an already installed ICP private image registry location?

Absolutely! It’s totally possible to move the storage location of an existing ICP private registry—you just need to follow a structured, low-risk process to avoid data loss or unnecessary downtime (though a small maintenance window will be required).

2. Safe, standardized migration process for low disk space

If your current /var/lib/registry is running out of space, here’s a tested, safe workflow to migrate the registry to a new disk/location:

Pre-Migration Prep (Critical!)

  • Backup first, always: Create a compressed backup of your current registry data to avoid disaster if something goes wrong. Run this command on the node hosting the registry:
    tar -czf registry-backup-$(date +%Y%m%d).tar.gz /var/lib/registry
    
    Store this backup somewhere off the current disk (like a separate server or cloud storage).
  • Validate the new storage: Make sure your new disk/location has enough space to hold all existing registry data (add 20-30% buffer for future growth). Format and mount it to a temporary path, e.g., /mnt/new-registry-storage.
  • Check permissions: Ensure the new directory has the same ownership/permissions as the original (usually root:root). Fix it if needed:
    chown -R root:root /mnt/new-registry-storage
    

Step 1: Stop the Registry Service

To prevent data corruption during the copy, scale down the registry deployment to zero replicas:

kubectl -n kube-system scale deployment ibm-registry --replicas=0

Wait until the pod is fully terminated (verify with kubectl -n kube-system get pods | grep ibm-registry).

Step 2: Copy Registry Data to the New Location

Use rsync to transfer the data—it preserves file permissions, timestamps, and can resume if interrupted:

rsync -avzh /var/lib/registry/ /mnt/new-registry-storage/

After the transfer completes, confirm the data sizes match to ensure nothing was missed:

du -sh /var/lib/registry
du -sh /mnt/new-registry-storage

Step 3: Update the Registry Deployment to Use the New Path

Edit the registry deployment to point to the new storage location:

kubectl -n kube-system edit deployment ibm-registry

Look for two sections:

  1. Under spec.template.spec.containers[0].volumeMounts, find the entry mounting to /var/lib/registry—note the name field (usually registry-storage).
  2. In the spec.template.spec.volumes section, find the volume with that name. Update the hostPath.path value from /var/lib/registry to /mnt/new-registry-storage.

Save your changes and exit the editor—Kubernetes will automatically spin up a new registry pod using the new storage.

Step 4: Verify the Migration

  • Check that the registry pod is running:
    kubectl -n kube-system get pods | grep ibm-registry
    
  • Test functionality: Pull a small public image, tag it for your private registry, push it, then pull it again to confirm everything works as expected.
  • Once you’re confident the migration succeeded, you can delete the old data from /var/lib/registry (but keep your backup for at least a week as a safety net).

Key Notes for Production Clusters

  • Downtime: Plan this during a maintenance window—scaling down the registry will block image pulls/pushes temporarily.
  • HA Clusters: If you have multiple master nodes running the registry, ensure the new storage is accessible to all nodes (e.g., use shared network storage like NFS, or sync the data to each node’s new path before updating the deployment).
  • PV/PVC Usage: If your registry uses PersistentVolumes (PVs) instead of hostPath, create a new PV pointing to the new storage, update the PVC to bind to this new PV, then restart the registry deployment.

内容的提问来源于stack exchange,提问作者Dtma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 06:35:12