美文网首页
镜像上传至harbor及harbor镜像使用说明

镜像上传至harbor及harbor镜像使用说明

作者: jojo1313 | 来源:发表于2023-04-24 15:39 被阅读0次

    准备工作

    1.修改docker配置文件,指定镜像登记地址等
    cat /etc/docker/daemon.json
    {
    "exec-opts": ["native.cgroupdriver=systemd"],
    "registry-mirrors": ["https://1jb.mirror.aliyuncs.com"],
    "insecure-registries": ["registry.icloud.net"]
    }
    systemctl daemon-reload
    systemctl restart docker

    上传步骤

    1.新建项目/目录(showdoc) http://registry.icloud.net/harbor/projects (harbor address)

    image.png

    2. 登录harbor: docker login registry.icloud.net

    3. 构建镜像: docker tag showdoc registry.icloud.net/showdoc/showdoc:v1

    4. 上传镜像到harbor: docker push registry.icloud.net/showdoc/showdoc:v1

    Harhor镜像使用方法:

    1.创建Secret
    登录k8s集群任意机器执行如下指令
    kubectl create secret docker-registry regcred -n default
    --docker-server=registry.icloud.net
    --docker-username=anzh
    --docker-password=B09kie*n
    --docker-email=anzh@icloud.com

    查看:kubectl get secret -n default
    2.编写yaml文件
    3.运行容器 kubectl apply -f showdoc.yaml

    异常处理:
    **A: **
    1./etc/docker/daemon.json 是否正确修改并重启docker
    2.registry.icloud.net域名应解析到1.25.16.13,查看/etc/hosts是否绑了host的

    **B: **
    容器部署失败查原因:kubectl describe pod showdoc-69ffdf58-dvvdm(pod id)

    相关文章

      网友评论

          本文标题:镜像上传至harbor及harbor镜像使用说明

          本文链接:https://www.haomeiwen.com/subject/oxbujdtx.html