【业务功能117】微服务-springcloud-springboot-Kubernetes集群-k8s集群-KubeSphere-公共服务 Harbor镜像仓库

2023-11-12

kubernetes集群公共服务 Harbor

一、 docker-ce安装

1.1 获取YUM源

使用阿里云开源软件镜像站。

# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo

1.2 安装并设置启动及开机自启动

# yum -y install docker-ce
# systemctl enable --now docker

二、 docker compose安装

下载docker-compose二进制文件
# wget https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64
查看已下载二进制文件
# ls
docker-compose-Linux-x86_64
移动二进制文件到/usr/bin目录,并更名为docker-compose
# mv docker-compose-Linux-x86_64 /usr/bin/docker-compose
为二进制文件添加可执行权限
# chmod +x /usr/bin/docker-compose
安装完成后,查看docker-compse版本
# docker-compose version
docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

三、 获取harbor安装文件

3.1 harbor下载

在这里插入图片描述在这里插入图片描述
在这里插入图片描述在这里插入图片描述在这里插入图片描述

在这里插入图片描述

下载harbor离线安装包
# wget https://github.com/goharbor/harbor/releases/download/v2.5.1/harbor-offline-installer-v2.5.1.tgz
查看已下载的离线安装包
# ls
harbor-offline-installer-v2.5.1.tgz

3.2 修改配置文件

解压harbor离线安装包
# tar xf harbor-offline-installer-v2.5.1.tgz
查看解压出来的目录
# ls
harbor 
查看harbor目录
# ls harbor
common.sh  harbor.v2.5.1.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepare
创建配置文件
# cd harbor/
# mv harbor.yml.tmpl harbor.yml
修改配置文件内容

# vim harbor.yml

# Configuration file of Harbor

# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: harbor.msb.com

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

# https related config
# https:
  # https port for harbor, default is 443
#  port: 443
  # The path of cert and key files for nginx
#  certificate: /root/harbor/6864844_kubemsb.com.pem 
#  private_key: /root/harbor/6864844_kubemsb.com.key

# # Uncomment following will enable tls communication between all harbor components
# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true
#   # put your cert and key files on dir
#   dir: /etc/harbor/tls/internal

# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433

# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: 12345 访问密码
......

3.3 执行预备脚本

# ./prepare
输出
prepare base dir is set to /root/harbor
Clearing the configuration file: /config/portal/nginx.conf
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir

3.4 执行安装脚本

# ./install.sh
输出
[Step 0]: checking if docker is installed ...

Note: docker version: 20.10.12

[Step 1]: checking docker-compose is installed ...

Note: docker-compose version: 1.25.0

[Step 2]: loading Harbor images ...

[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/harbor

[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-db     ... done
Creating registry      ... done
Creating registryctl   ... done
Creating redis         ... done
Creating harbor-portal ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done
✔ ----Harbor has been installed and started successfully.----

3.5 验证运行情况

# docker ps
CONTAINER ID   IMAGE                                COMMAND                  CREATED              STATUS                        PORTS                                                                            NAMES
71c0db683e4a   goharbor/nginx-photon:v2.5.1         "nginx -g 'daemon of…"   About a minute ago   Up About a minute (healthy)   0.0.0.0:80->8080/tcp, :::80->8080/tcp, 0.0.0.0:443->8443/tcp, :::443->8443/tcp   nginx
4e3b53a86f01   goharbor/harbor-jobservice:v2.5.1    "/harbor/entrypoint.…"   About a minute ago   Up About a minute (healthy)                                                                                    harbor-jobservice
df76e1eabbf7   goharbor/harbor-core:v2.5.1          "/harbor/entrypoint.…"   About a minute ago   Up About a minute (healthy)                                                                                    harbor-core
eeb4d224dfc4   goharbor/harbor-portal:v2.5.1        "nginx -g 'daemon of…"   About a minute ago   Up About a minute (healthy)                                                                                    harbor-portal
70e162c38b59   goharbor/redis-photon:v2.5.1         "redis-server /etc/r…"   About a minute ago   Up About a minute (healthy)                                                                                    redis
8bcc0e9b06ec   goharbor/harbor-registryctl:v2.5.1   "/home/harbor/start.…"   About a minute ago   Up About a minute (healthy)                                                                                    registryctl
d88196398df7   goharbor/registry-photon:v2.5.1      "/home/harbor/entryp…"   About a minute ago   Up About a minute (healthy)                                                                                    registry
ed5ba2ba9c82   goharbor/harbor-db:v2.5.1            "/docker-entrypoint.…"   About a minute ago   Up About a minute (healthy)                                                                                    harbor-db
dcb4b57c7542   goharbor/harbor-log:v2.5.1           "/bin/sh -c /usr/loc…"   About a minute ago   Up About a minute (healthy)   127.0.0.1:1514->10514/tcp                                                        harbor-log

3.6 访问harbor UI界面

直接浏览器访问 harbor主机ip即可跳转
在这里插入图片描述
在这里插入图片描述

四、配置Docker使用Harbor

配置之前建议把harbor服务停止,修改后再重启

  • 命令:docker-compose down
  • 主要除了在harbor主机上配置 还需要在K8S集群的三台主机上配置 集群才能访问harbor
# vim /etc/docker/daemon.json

{							
    //这里由于有前面配置有DNS服务,访问也可以用域名 harbor.msb.com
  "insecure-registries": ["http://192.168.10.246"]			
}

  • 修改了docker配置文件 需要重启
# systemctl restart docker    

-然后再重启harbor服务 -d表示后台运行

# docker-compose up -d   

验证是否可以使用

提示输入登录账户密码,成功即表示可以访问

# docker login harbor.msb.com

五、上传镜像到harbor服务演示

1.拉取镜像 举例nginx

# docker pull nginx:lastest

2.重新标记新的镜像,用来上传的镜像

  • tag 标记 源镜像 目标镜像位置:标记值 library是harbor默认文件夹目录在下面创建nginx目录
#  docker images     //先查看镜像拉取是否成功
#  docker -tag nginx:lastest harbor.msb.com/library/nginx:v1 

3.登录harbor ,进行上传镜像

  • 上传成功后,就可以在harbor客户端界面-项目栏目-点击library进入可看到有nginx目录,里面有一个镜像文件了
# docker login harbor.msb.com
# docker push harbor.msb.com/library/nginx:v1 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【业务功能117】微服务-springcloud-springboot-Kubernetes集群-k8s集群-KubeSphere-公共服务 Harbor镜像仓库 的相关文章

  • DVP,LVDS和MIPI

    Mipi 接口 和 LVDS 接口区别 主要区别 1 LVDS接口只用于传输视频数据 MIPI DSI不仅能够传输视频数据 还能传输控制指令 2 LVDS接口主要是将RGB TTL信号按照SPWG JEIDA格式转换成LVDS信号进行传输
  • 记录自己在结构光三维重建领域的学习过程(五)

    读了一篇论文 Domain randomization for transferring deep neural networks from simulation to the real world 讲的是域随机化 但其实我没有认真看 其实
  • html转pdf

    html转pdf 本地安装wkhtmltopdf Java操作wkhtmltopdf实现Html转PDF 本地测试

随机推荐

  • sqlite3的交叉编译

    比如说我们在qtcreator中编写程序的时候想用到sqlite3数据库 但是因为qtcreator中的编译器中的库中并没有sqlite3的库 所以肯定编译不了 所以若想在qtcreator中编译sqlite3的程序 首先的将sqlite3
  • 初级python爬虫薪资-月薪2万的爬虫工程师,Python需要学到什么程度?

    Python 爬虫学到什么样就可以找工作了 非计算机专业 正在自学python 很多教程里提到的网站的爬虫都会写了 比如拉勾网 豆瓣 实习僧 京东 淘宝 某妹子图等等 但是因为不是计算机专业的 也没学所谓的四大名著 不知道那四大对找工作重要
  • 残体字符设计:INVETA

    残体字符设计是logo设计中很常见的一种风格 它通过删减 多余 的笔画来实现残缺的字符 让读者通过 脑补 还原出原来的文字 以此独特的风格加深用户的产品印象 Github支持STL文本格式的3D模型预览 奈何STL格式非常简陋 难以表示复杂
  • android 的 Testing Support Library 测试支持包(库)

    Testing Support Library 测试支持包 库 这个库提供了一系列的api来快速的创建和运行测试对于你的app 包括jUnit 4 和用户 UI 的测试 创建可以使用android studio IDE 或者通过命令行 两种
  • 日志:slf4j+logback 的配置与使用

    1 常用日志组件和选择 java开发日志处理是发现和调试bug所 必不可少的 那么现在企业中常用的日志组件有哪些呢 JCL JUL SLF4j Log4j Log4j2 Logback jboss loggin 等 一般日志是配套出现的 一
  • 内存请求分页实验java_请求分页内存管理的模拟

    一 实验题目 二 代码 1 Main java package OS import java util Scanner public class Main public static int pageSize blockSize procS
  • CentOS8提高篇11:centos8软件安装dnf命令

    DNF是新一代的rpm软件包管理器 它首先出现在 Fedora 18 这个发行版中 而目前 它取代了yum 正式成为从 Fedora 22 起 Fedora 版本的包管理器 DNF包管理器克服了YUM包管理器的一些瓶颈 提升了包括用户体验
  • SE0、J、K 、Chirp J、Chirp K

    SE0 J K Chirp J Chirp K 是 USB 总线上常见的信号状态 用于表示不同的电平和信号类型 SE0 Single Ended Zero 是 USB 总线上的空闲状态 表示逻辑低电平 在 SE0 状态下 数据线 D 和 D
  • Git 强制回退到某个历史版本再推送到远程

    1 使用 git log 命令历史版本记录回退版本 git reset hard f6a7c803a6931a9eca011d4e097389e0845cbe49 2 推送到远程 git push f u origin master ps
  • sqli-labs18、19关详解

    18关 对两个输入框都进行了设置 所以只能寻找其他注入点 看到insert语句从uagents插入 我们可以用http header live插件得到post内容放进hackbar中 再在user agent里面添加修改
  • [382]定时任务JoBX(opencron升级版)

    opencron文章链接 https blog csdn net xc zhou article details 80950811 升级日志 V1 2 0 by 2018 xx xx 1 支持Window端 实现全平台编译和安装 2 简化安
  • 八大排序算法总结Java代码实现(建议收藏后食用)

    目录 排序算法介绍 相关术语 排序的稳定性 排序分类 内排序与外排序 算法时间复杂度 度量一个程序 算法 执行时间的两种方法 时间频度 忽略常数项 忽略低次项 忽略系数 时间复杂度 常数阶O 1 对数阶O log2n 线性阶O n 线性对数
  • 词法分析器(分析C语言)

    问题描述 用C或C 语言编写一个简单的词法分析程序 扫描C语言小子集的源程序 根据给定的词法规则 识别单词 填写相应的表 如果产生词法错误 则显示错误信息 位置 并试图从错误中恢复 简单的恢复方法是忽略该字符 或单词 重新开始扫描 相关词法
  • MacOS 安装GO环境与测试

    MacOS 安装GO环境 一 下载安装包 二 验证GO的版本 三 配置代理 3 1 GO111MODULE 3 2 GOPROXY 四 初始化项目 五 编译运行代码 引用 MacOS版本 Catalina 10 15 2 GO版本 go1
  • 怎样查看对方计算机网络密码,如何查看邻居家的wifi密码?不知道wifi密码怎么蹭网...

    如何查看邻居家的wifi密码 不知道wifi密码怎么蹭网 不知道大家有没有遇到这样的问题 手机虽然已经连接到了WiFi 但是却已经忘记了WiFi密码 这时候如果会有一丝担忧在心中 如果下次连接不上 或是有人问你密码 该怎么办连接WiFi呢
  • 《COM原理及应用》学习笔记之第十一章

    第11章 自动化 Automation 对象 1 自动化技术 自动化技术既以前提到的OLE自动化 虽然自动化技术建立在COM基础上 但自动化要比COM应用广泛得多 一方面 自动化继承了COM的很多优点 比如语言无关 进程透明等特性 另一方面
  • vc中gb2312和UTF-8的转换

    1 1 tools h include
  • CentOS7安装Hadoop集群完整步骤

    准备工作 搭建集群 所有机器的必须改成静态static 相关网址 https blog csdn net weixin 55076626 article details 126904432 csdn share tail 7B 22type
  • 2023华为od机试统一考试B卷Java【喊7游戏】

    前言 本题使用Java实现 如果需要python代码 请点击以下链接 点我 题目描述 喊7是一个传统的聚会游戏 N个人围成一圈 按顺时针从1到N编号 编号为1的人从1开始喊数 下一个人喊的数字为上一个人的数字加1 但是当将要喊出来的数字是7
  • 【业务功能117】微服务-springcloud-springboot-Kubernetes集群-k8s集群-KubeSphere-公共服务 Harbor镜像仓库

    kubernetes集群公共服务 Harbor 一 docker ce安装 1 1 获取YUM源 使用阿里云开源软件镜像站 wget https mirrors aliyun com docker ce linux centos docke