2

k8s学习配置harbor的nfs对接以及配置为helm仓库

 1 year ago
source link: https://blog.51cto.com/u_11555417/5525924
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的nfs对接以及配置为helm仓库

推荐 原创

羊草 2022-07-29 12:18:59 博主文章分类:docker&k8s ©著作权

文章标签 上传 git 服务器 文章分类 kubernetes 云计算 阅读数335

harbor可以对接NFS作为远端存储,提高harbor仓库的存储空间

配置nfs

nfs服务器配置省略,主要配置nfs-client

yum install -y nfs-utils
# showmount -e $(nfs服务器的IP)
showmount -e 192.168.85.6
# 输出结果如下所示
Export list for 192.168.85.6:
/root/nfs_root *
mkdir /root/nfsmount
# mount -t nfs $(nfs服务器的IP):/root/nfs_root /root/nfsmount
mount -t nfs 192.168.85.6/root/nfs_root /root/nfsmount

配置完成后,检查挂载是否生效

k8s学习配置harbor的nfs对接以及配置为helm仓库_git

修改harbor的yaml配置文件,如下配置

vim harbor.yml
k8s学习配置harbor的nfs对接以及配置为helm仓库_上传_02

1 取消#storage_service的注释

2 修改data_volume 为 挂载目录

配置helm

由于新版的harbor默认没有安装helm等组件,需要添加参数安装

sh install.sh --with-trivy --with-chartmuseum

关于组件和配置文件的说明,参考官网

 ​海港文档 |配置海港 YML 文件 (goharbor.io)​

启动harbor

显示项目中带有helm标签,表示配置成功

k8s学习配置harbor的nfs对接以及配置为helm仓库_git_03

配置了trivy 扫描器后,harbor就可以对上传到仓库的镜像进行扫描

k8s学习配置harbor的nfs对接以及配置为helm仓库_服务器_04

使用helm上传chart到harbor

在使用helm完成了chart打包之后,就可以将chart上传到harbor了

首先使用helm添加harbor仓库

helm repo add --username user --password Harbor12345 harbor_local http://192.168.85.3:8090/chartrepo/test
helm repo list
k8s学习配置harbor的nfs对接以及配置为helm仓库_上传_05

在使用helm push之前,必须先安装helm插件,helm默认是没有这个插件的

#首先安装git
yum install git -y
#然后安装插件
helm plugin install https://github.com/chartmuseum/helm-push
#heml plugin list
k8s学习配置harbor的nfs对接以及配置为helm仓库_git_06
k8s学习配置harbor的nfs对接以及配置为helm仓库_git_07

然后上传chart

helm push mychart-0.2.0.tgz harbor_local
k8s学习配置harbor的nfs对接以及配置为helm仓库_服务器_08

登录harbor,确认存在

k8s学习配置harbor的nfs对接以及配置为helm仓库_上传_09
k8s学习配置harbor的nfs对接以及配置为helm仓库_服务器_10

使用harbor页面上传chart

将chart的安装包,上传到harbor中,通过页面方式

k8s学习配置harbor的nfs对接以及配置为helm仓库_服务器_11
k8s学习配置harbor的nfs对接以及配置为helm仓库_服务器_12

确认上传成功

进入chart后,可以看到添加仓库和安装chart的方法

k8s学习配置harbor的nfs对接以及配置为helm仓库_git_13

使用helm install 安装harbor仓库的的chart

在使用之前,首先必须更新仓库,避免找不到chart包

helm repo update harbor_local
k8s学习配置harbor的nfs对接以及配置为helm仓库_上传_14

然后使用helm从harbor安装

helm install myappnew --version 0.2.0 harbor_local/mychart --debug
helm list
k8s学习配置harbor的nfs对接以及配置为helm仓库_服务器_15

已确认从harbor安装chart

  • 打赏
  • 1
  • 收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK