zoukankan      html  css  js  c++  java
  • harbor关联k8s

    第一步

       在harbor上创建用户,项目,将用户添加到对应项目中,并赋予用户项目管理者或者开发人员权限,使其对镜像仓库有读写权限。

       本次部署创建用户liusw,密码Lsw123456,邮箱873001704@qq.com,项目batman

    第二步 创建secret

    kubectl create secret docker-registry harbortest --docker-server=172.19.68.11:5000 --docker-username=liusw --docker-password=Lsw123456 --docker-email=873001704@qq.com

        查看secret的内容

        kubectl get secret harbortest -o yaml

    在node结点登录到harbor

    docker login 172.19.68.11:5000

     报错如下

    Error response from daemon: Get https://172.19.68.11:5000/v1/users/: http: server gave HTTP response to HTTPS client

    解决办法:

    查看单独安装harbor服务器的配置

    [root@izuf66p8tou7n3ktvgnu8pz docker]# vim /etc/docker/daemon.json
    { "registry-mirrors": ["https://wb2g6zxl.mirror.aliyuncs.com"],"insecure-registries":["172.19.68.11:5000"]}

    在node结点新增如下配置

    修改配置文件, 增加  --insecure-registry=172.19.68.11:5000 选项

    [root@node2 yum.repos.d]# find / -name docker.service -type f
    /usr/lib/systemd/system/docker.service
    [root@node2 yum.repos.d]# cat /usr/lib/systemd/system/docker.service
    [Unit]
    Description=Docker Application Container Engine
    Documentation=http://docs.docker.com
    After=network.target
    Wants=docker-storage-setup.service
    Requires=docker-cleanup.timer
    
    [Service]
    Type=notify
    NotifyAccess=main
    EnvironmentFile=-/run/containers/registries.conf
    EnvironmentFile=-/etc/sysconfig/docker
    EnvironmentFile=-/etc/sysconfig/docker-storage
    EnvironmentFile=-/etc/sysconfig/docker-network
    Environment=GOTRACEBACK=crash
    Environment=DOCKER_HTTP_HOST_COMPAT=1
    Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
    ExecStart=/usr/bin/dockerd-current --insecure-registry=172.19.68.11:5000 
              --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current 
              --default-runtime=docker-runc 
              --exec-opt native.cgroupdriver=systemd 
              --userland-proxy-path=/usr/libexec/docker/docker-proxy-current 
              --init-path=/usr/libexec/docker/docker-init-current 
              --seccomp-profile=/etc/docker/seccomp.json 
              $OPTIONS 
              $DOCKER_STORAGE_OPTIONS 
              $DOCKER_NETWORK_OPTIONS 
              $ADD_REGISTRY 
              $BLOCK_REGISTRY 
              $INSECURE_REGISTRY 
              $REGISTRIES
    ExecReload=/bin/kill -s HUP $MAINPID
    LimitNOFILE=1048576
    LimitNPROC=1048576
    LimitCORE=infinity
    TimeoutStartSec=0
    Restart=on-abnormal
    KillMode=process
    
    [Install]
    WantedBy=multi-user.target

    重启docker

    systemctl daemon-reload

    systemctl restart docker

    查看服务,已经包含了 --insecure-registry=172.19.68.11:5000 参数

    [root@node2 yum.repos.d]# ps aux|grep docker
    root     14982  0.8  0.2 1199240 44800 ?       Ssl  19:37   0:00 /usr/bin/dockerd-current --insecure-registry=172.19.68.11:5000 --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json --selinux-enabled --log-driver=journald --signature-verification=false --storage-driver overlay2
    root     14990  0.1  0.0 649500 15508 ?        Ssl  19:37   0:00 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc --runtime-args --systemd-cgroup=true
    root     15288  0.0  0.0 282712  4988 ?        Sl   19:37   0:00 /usr/bin/docker-containerd-shim-current 0ea8705364158e32219dfdd182071e213e3d0e2d3e5c2d6f2c28db3683d18c29 /var/run/docker/libcontainerd/0ea8705364158e32219dfdd182071e213e3d0e2d3e5c2d6f2c28db3683d18c29 /usr/libexec/docker/docker-runc-current
    root     15298  0.0  0.0 413784  2940 ?        Sl   19:37   0:00 /usr/bin/docker-containerd-shim-current 60bb2cb57c6d406d6b7ffe3ace4d551d914ef44d43f2db7b8f8ed7f292123456 /var/run/docker/libcontainerd/60bb2cb57c6d406d6b7ffe3ace4d551d914ef44d43f2db7b8f8ed7f292123456 /usr/libexec/docker/docker-runc-current
    root     15299  0.0  0.0 282968  4988 ?        Sl   19:37   0:00 /usr/bin/docker-containerd-shim-current 38c7b675205a7d24705ce9377a02427b9f888178ae1e73669980e4d269f35678 /var/run/docker/libcontainerd/38c7b675205a7d24705ce9377a02427b9f888178ae1e73669980e4d269f35678 /usr/libexec/docker/docker-runc-current
    root     15441  0.0  0.0 282968  4988 ?        Sl   19:37   0:00 /usr/bin/docker-containerd-shim-current d4de3b840b48380f3641ead439748623310a08698a9b6b21d0f0444625809476 /var/run/docker/libcontainerd/d4de3b840b48380f3641ead439748623310a08698a9b6b21d0f0444625809476 /usr/libexec/docker/docker-runc-current
    root     15688  0.0  0.0 348248  4992 ?        Sl   19:38   0:00 /usr/bin/docker-containerd-shim-current 7d28ff21af8450030f023e18930035030b2ce4b2e5bb7a72fbdbd91f4327a820 /var/run/docker/libcontainerd/7d28ff21af8450030f023e18930035030b2ce4b2e5bb7a72fbdbd91f4327a820 /usr/libexec/docker/docker-runc-current
    root     15765  0.0  0.0 348504  4988 ?        Sl   19:38   0:00 /usr/bin/docker-containerd-shim-current bc67333d4ff8dc26bc5d8dfe70c7a141db40663030db2f1f79f800575865980f /var/run/docker/libcontainerd/bc67333d4ff8dc26bc5d8dfe70c7a141db40663030db2f1f79f800575865980f /usr/libexec/docker/docker-runc-current
    root     15980  0.0  0.0 112664   964 pts/0    S+   19:39   0:00 grep --color=auto docker
    [root@node2 yum.repos.d]# docker login 172.19.68.11:5000
    Username: liusw
    Password: 
    Login Succeeded
  • 相关阅读:
    实时控制软件第四周作业
    实时控制软件第三次作业-编程作业(更新梯形加速并绘制轨迹)
    实时控制软件第三次作业(编程作业)-更新中
    实时控制软件设计第二周作业-停车场门禁控制系统状态机
    冰球游戏开发日志(四)
    冰球游戏开发日志(三)
    冰球项目开发日志(二)
    冰球项目开发日志(一)
    第四周作业
    第三周作业
  • 原文地址:https://www.cnblogs.com/mutong1228/p/10918212.html
Copyright © 2011-2022 走看看