2

如何在k8s集群里更换harbor-registry的镜像源

 1 year ago
source link: https://blog.51cto.com/u_15380854/5640207
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

如何在k8s集群里更换harbor-registry的镜像源

精选 原创

kiroct 2022-09-01 10:34:10 ©著作权

文章标签 k8s 更换harbor-r镜像源 文章分类 kubernetes 云计算 阅读数262

环境:一个k8s高可用集群;这里使用ceph做挂载

步骤:
1、备份harbor-registry的deployment

kubectl get deployment -n (namespaces)  harbor-registry -o yaml > /opt/1.yaml    #导出文件

mkdir /opt/test      #创建挂载目录
#然后把准备好的tar.gz镜像包文件放在目录里面并解压

kubectl delete deployment -n (namespaces)  harbor-registry   #删除现在的harbor仓库

awk -F" |," '/mon host/{print $4":6789,"$5":6789,"$6":6789:"}' /etc/ceph/ceph.conf

awk '/key/{print $NF}' /etc/ceph/ceph.client.admin.keyring

kubectl describe pv `kubectl -n kedacom-project-namespace get pvc | awk '/pvc-registory/{print $3}'` | awk '/Path/{print $2}'


mount -t ceph ceph地址:6789:获取到的目录  本地路径(/mnt/cephfs-registry) -o name=admin,secret=获取到的key         #进行test目录的挂载,上面3步是分别获取这些内容

现在我们的临时目录/opt/test已经挂载到ceph上了,包也在test里面解压了,

#重启harbor-registry
kubectl apply -f /opt/1.yaml  #刚才导出来的harbor-registry的deployment

然后等待30s左右harbor-registry的podrunning了,即可获取我们导入的所有镜像
kubectl get pod -n (namespaces) | grep harbor-registry  #查看pod是否已经启动完成
  • 打赏
  • 收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK