harbor搭建

回到目录

Harbor 是 VMware 公司开源的企业级 Docker Registry 项目,其目标是帮助用户迅速搭建一个企业级的 Docker Registry 服务

通俗的讲,harbor是一个私人镜像存储服务器

1 下载安装

进入官网,下载一个离线安装包,harbor官网下载

这里选择当前最新版本为:harbor-offline-installer-v2.8.2.tgz

1.1 完成后,解压

root@k8s-work1 harbor]# ls
harbor-offline-installer-v2.8.2.tgz

[root@k8s-work1 harbor]# tar -zxvf harbor-offline-installer-v2.8.2.tgz 
harbor/harbor.v2.8.2.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl

[root@k8s-work1 harbor]# ls
harbor  harbor-offline-installer-v2.8.2.tgz

[root@k8s-work1 harbor]# cd harbor/
[root@k8s-work1 harbor]# ls
common.sh  harbor.v2.8.2.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepare

1.2 修改配置文件

修改复制一份harbor.yml.tmpl 重命名为harbor.yml

修改harbor.yml

  • hostname修改为安装harbor的服务器ip

  • 修改port为8858或者自定义其他

  • 修改密码为1234Qwer或者其他

  • 注释https部分

hostname: 10.1.57.201

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 8858

# https related config
#https:
  # https port for harbor, default is 443
#  port: 443
  # The path of cert and key files for nginx
#  certificate: /your/certificate/path
#  private_key: /your/private/key/path
harbor_admin_password: 1234Qwer

1.3 执行install.sh命令

#出现successfully说明安装成功
✔ Container harbor-jobservice  Started                                        
✔ ----Harbor has been installed and started successfully.----

2 访问UI

服务器ip:port

用户名admin

密码harbor.yml中修改密码

 

harbor搭建_第1张图片

3 docker添加仓库

在k8s集群中每个节点的docker添加harbor仓库

每个节点的docker中daemon.json添加harbor地址

地址具体为安装harbor的服务器的ip和短裤

注意:ip为服务器的公网ip,如果是通过zerotier搭建的私网ip也可以,总之,确保k8s集群节点能够正常访问该ip

{

  "insecure-registries": ["30.13.4.55:8858"],

}

配置生效

systemctl daemon-reload
systemctl restart docker

验证

在k8s集群节点上操作,docker 登陆到harbor

[root@k8s-work1 harbor]# docker login -uadmin ip:port
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

 

你可能感兴趣的:(kubernetes,kubernetes,容器,云原生)