章工运维 章工运维
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

章工运维

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • ansible系列文章

  • Kubernetes笔记

    • 安装篇-kubeadm
    • k8s入门
    • k8s安装篇二进制
    • k8s面试题
    • kubernetes(k8s)yaml文件详解
    • k8s报错小结
    • Kubernetes 安装配置ingress controller
    • cka考试真题
    • ingress配置证书
    • cka考试作业
    • k8s部署java项目
    • jenkins脚本式流水线部署k8s项目实例一
    • helm v3安装并创建例子
    • 使用helm将本地部署文件上传到harbor chart上
      • helm公共仓库创建
      • helm适应minio作为私有仓库
      • helm release使用说明
      • kubernetes核心概念
      • kubectl使用技巧
      • kubernetes卷的几种类型
      • kubernetes安全框架
      • 云原生-什么是HPA和PDB、VPA
      • k8s部署php项目示例
      • 配置kubeconfig 文件访问 Kubernetes 集群
      • configmap配置的几种方式
      • k8s配置go服务
      • k8s部署java项目
      • kubernetes部署prometheus监控
      • kubernetes部署elk日志系统
      • kubernetes环境devops流水线
      • kubernetes高阶技能必备的工具
      • deployment中使用configmap、secret的方式
      • 业务pod 飘移pending排查分析
    • elk

    • jenkins

    • GitLabCI_CD

    • 专题
    • Kubernetes笔记
    章工运维
    2023-06-11
    目录

    使用helm将本地部署文件上传到harbor chart上

    # 一、harbor开启支持helm chart

    1、修改harbor配置文件

    vim harbor.yml
    chart:
      # Change the value of absolute_url to enabled can enable absolute url in chart
      absolute_url: enabled
    
    1
    2
    3
    4

    2、停止harbor服务

    docker-compose stop
    
    1

    3、注入配置

    [root@localhost harbor]# ./prepare 
    
    1

    4、安装chartmuseum

    在执行install.sh安装脚本时,通过--with-chartmuseum参数安装chart插件。

    [root@localhost harbor]# ./install.sh  --with-notary --with-trivy --with-chartmuseum
    
    1

    5、验证

    edcee6f2922e01f0.jpg

    # 二、添加harbor作为chart仓库

    添加的命令

    [root@k8s-master01 repo]# helm repo add --username=admin --password=xxxxxxxx 1quant_harbor https://xxxxx:8443/chartrepo/library
    
    1

    查看验证

    [root@k8s-master01 ~]# helm repo list
    NAME            URL                                                   
    1quant_harbor   https://xxxx:8443/chartrepo/library           
    aliyun          https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
    

    三、推送和拉取chart

    Helm 要想推送 Chart 到 Helm 仓库,需要提前安装上传插件:

    helm plugin install https://github.com/chartmuseum/helm-push
    #或者离线安装
    mkdir /root/.local/share/helm/plugins/helm-push
    
    cp helm-push_0.9.0_linux_amd64.tar.gz /root/.local/share/helm/plugins/helm-push
    
    tar zxvf /root/.local/share/helm/plugins/helm-push/helm-push_0.9.0_linux_amd64.tar.gz
    helm plugin list #查看
    
    1
    2
    3
    4
    5
    6
    7
    8

    创建项目并推送chart到harbor

    # 然后创建一个测试的 Chart 进行推送测试:
    helm create hello-helm
    
    # 打包chart,将chart打包成tgz格式
    helm package hello-helm
    
    #推送
    helm cm-push hello-helm-0.1.0.tgz --username=admin --password=xxxxx
    
    #拉取
    helm pull --username=admin --password=xxxx 1quant_harbor/hello-helm
    
    # 安装
    helm install test-helm --username=admin --password=xxxxx --version 0.1.0 1quant_harbor/hello-helm
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14

    注意事项

    在 Harbor 2.0 版本中,存储库仓库是不支持直接更新索引文件的。相比于传统的 Helm Chart 仓库,Harbor 更专注于容器镜像的存储和分发,因此在 Harbor 中并没有直接支持索引文件的更新功能。

    如果你需要更新存储在 Harbor 中的 Helm Chart,可以通过以下方式来实现:

    1. 重新上传 Helm Chart: 首先,你需要在本地重新构建或修改 Helm Chart,并生成一个新的 .tgz 文件。然后,使用 helm push 命令将新的 Helm Chart 上传到 Harbor 中。

      helm push mychart-1.0.0.tgz my-repo
      
      1

      其中,mychart-1.0.0.tgz 是新生成的 Helm Chart 文件,my-repo 是你在 Helm 中配置的 Harbor 存储库名称。

    2. 更新存储库: 上传新的 Helm Chart 后,你需要更新 Helm 存储库的索引文件。在本地执行以下命令:

      helm repo update
      
      1

      这将从存储库中下载最新的索引文件,以使 Helm 可以获取到最新的可用 Chart。

    需要注意的是,由于 Harbor 主要用于容器镜像管理,而不是传统的 Helm Chart 仓库,因此在更新 Helm Chart 时需要手动重新上传并更新索引文件。

    微信 支付宝
    上次更新: 2023/06/12, 22:07:24

    ← helm v3安装并创建例子 helm公共仓库创建→

    最近更新
    01
    shell脚本模块集合
    05-13
    02
    生活小技巧(认知版)
    04-29
    03
    生活小技巧(防骗版)
    04-29
    更多文章>
    Theme by Vdoing | Copyright © 2019-2025 | 点击查看十年之约 | 鄂ICP备2024072800号
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式