• ChartMuseum的安装教程和基本配置


    一. 安装docker-compose

    curl -L https://github.com/docker/compose/releases/download/1.29.0/docker-compose-uname -s-uname -m -o /usr/local/bin/docker-compose
    
    • 1

    上条命令自动安装版本为1.29.0 的docker-compose

    二. 安装chartmuseum 和chartmuseumui

    mkdir /opt/chartmuseum
    cd /opt/chartmuseum/
    vim docker-compose.yaml
    
    • 1
    • 2
    • 3
    version: '3.0'
    services:
       ui:
         #build: ./
         image: idobry/chartmuseumui:latest
         environment:
           CHART_MUSESUM_URL: http://chartmuseum:8080
         ports:
           - 1999:8080
         container_name: chartui
       chartmuseum:
         image: chartmuseum/chartmuseum:latest
         volumes:
         - ./charts:/charts
         restart: always
         environment:
           PORT: 8080
           STORAGE: local
           STORAGE_LOCAL_ROOTDIR: /charts
         ports:
           - 8089:8080
         container_name: chartmuseum
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    三. 可能会出现的问题

         volumes:
         - ./charts:/charts
    
    • 1
    • 2

    就上面这docker挂载没有权限,进入docker里看/charts 目录是什么用户和组,然后退出容器就给宿主机./charts 权限。

    四.API

    curl -X GET "chart=@mychart-0.1.0.tgz" http://localhost:8089/api/org1/repoa/charts 
    
    • 1

    Helm Chart Repository

    GET /index.yaml - retrieved when you run helm repo add chartmuseum http://localhost:8089/
    GET /charts/mychart-0.1.0.tgz - retrieved when you run helm install chartmuseum/mychart
    GET /charts/mychart-0.1.0.tgz.prov - retrieved when you run helm install with the --verify flag
    
    • 1
    • 2
    • 3

    Chart Manipulation

    POST /api/charts - upload a new chart version
    POST /api/prov - upload a new provenance file
    DELETE /api/charts// - delete a chart version (and corresponding provenance file)
    GET /api/charts - list all charts
    GET /api/charts/ - list all versions of a chart
    GET /api/charts// - describe a chart version
    GET /api/charts///templates - get chart template
    GET /api/charts///values - get chart values
    HEAD /api/charts/ - check if chart exists (any versions)
    HEAD /api/charts// - check if chart version exists
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    Server Info

    GET / - HTML welcome page
    GET /info - returns current ChartMuseum version
    GET /health - returns 200 OK
    
    • 1
    • 2
    • 3

    五 安装helm-push插件

    https://github.com/chartmuseum/helm-push
    下载 linux可执行文件 https://github.com/chartmuseum/helm-push/releases/download/v0.10.2/helm-push_0.10.2_linux_amd64.tar.gz
    解压缩

    tar -zxvf helm-push_0.10.2_linux_amd64.tar.gz 
    [root@node-194 helm-push]# ls
    bin  LICENSE  plugin.yaml
    
    ### /root/.local/share/helm/plugins/helm-push/bin/helm-cm-push
    cp /home/helm-push /root/.local/share/helm/plugins/
    
    [root@node-194 helm-push]# helm env
    HELM_BIN="helm"
    HELM_CACHE_HOME="/root/.cache/helm"
    HELM_CONFIG_HOME="/root/.config/helm"
    HELM_DATA_HOME="/root/.local/share/helm"
    HELM_DEBUG="false"
    HELM_KUBEAPISERVER=""
    HELM_KUBEASGROUPS=""
    HELM_KUBEASUSER=""
    HELM_KUBECAFILE=""
    HELM_KUBECONTEXT=""
    HELM_KUBETOKEN=""
    HELM_MAX_HISTORY="10"
    HELM_NAMESPACE="default"
    HELM_PLUGINS="/root/.local/share/helm/plugins"
    HELM_REGISTRY_CONFIG="/root/.config/helm/registry.json"
    HELM_REPOSITORY_CACHE="/root/.cache/helm/repository"
    HELM_REPOSITORY_CONFIG="/root/.config/helm/repositories.yaml"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25

    验证

    [root@node-194 helm-push]# helm cm-push --help
    Helm plugin to push chart package to ChartMuseum
    
    Examples:
    
      $ helm cm-push mychart-0.1.0.tgz chartmuseum       # push .tgz from "helm package"
      $ helm cm-push . chartmuseum                       # package and push chart directory
      $ helm cm-push . --version="1.2.3" chartmuseum     # override version in Chart.yaml
      $ helm cm-push . https://my.chart.repo.com         # push directly to chart repo URL
    
    Usage:
      helm cm-push [flags]
    
    Flags:
          --access-token string             Send token in Authorization header [$HELM_REPO_ACCESS_TOKEN]
      -a, --app-version string              Override app version pre-push
          --auth-header string              Alternative header to use for token auth [$HELM_REPO_AUTH_HEADER]
          --ca-file string                  Verify certificates of HTTPS-enabled servers using this CA bundle [$HELM_REPO_CA_FILE]
          --cert-file string                Identify HTTPS client using this SSL certificate file [$HELM_REPO_CERT_FILE]
          --check-helm-version              outputs either "2" or "3" indicating the current Helm major version
          --context-path string             ChartMuseum context path [$HELM_REPO_CONTEXT_PATH]
          --debug                           Enable verbose output
      -d, --dependency-update               update dependencies from "requirements.yaml" to dir "charts/" before packaging
      -f, --force                           Force upload even if chart version exists
      -h, --help                            help for helm
          --home string                     Location of your Helm config. Overrides $HELM_HOME (default "/root/.helm")
          --host string                     Address of Tiller. Overrides $HELM_HOST
          --insecure                        Connect to server with an insecure way by skipping certificate verification [$HELM_REPO_INSECURE]
          --key-file string                 Identify HTTPS client using this SSL key file [$HELM_REPO_KEY_FILE]
          --keyring string                  location of a public keyring (default "/root/.gnupg/pubring.gpg")
          --kube-context string             Name of the kubeconfig context to use
          --kubeconfig string               Absolute path of the kubeconfig file to be used
      -p, --password string                 Override HTTP basic auth password [$HELM_REPO_PASSWORD]
          --tiller-connection-timeout int   The duration (in seconds) Helm will wait to establish a connection to Tiller (default 300)
          --tiller-namespace string         Namespace of Tiller (default "kube-system")
      -t, --timeout int                     The duration (in seconds) Helm will wait to get response from chartmuseum (default 30)
      -u, --username string                 Override HTTP basic auth username [$HELM_REPO_USERNAME]
      -v, --version string                  Override chart version pre-push
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39

    上传chart

    [root@node-194 chart]# helm repo add chartmuseum http://localhost:8089
    "chartmuseum" has been added to your repositories
    [root@node-194 chart]# helm repo list
    NAME            URL                  
    chartmuseum     http://localhost:8089
    [root@node-194 chart]# helm cm-push mysql
    mysql/           mysql-1.6.9.tgz  
    [root@node-194 chart]# helm cm-push mysql-1.6.9.tgz chartmuseum
    Pushing mysql-1.6.9.tgz to chartmuseum...
    Error: 500: open /charts/mysql-1.6.9.tgz: permission denied
    Usage:
      helm cm-push [flags]
    
    Flags:
          --access-token string             Send token in Authorization header [$HELM_REPO_ACCESS_TOKEN]
      -a, --app-version string              Override app version pre-push
          --auth-header string              Alternative header to use for token auth [$HELM_REPO_AUTH_HEADER]
          --ca-file string                  Verify certificates of HTTPS-enabled servers using this CA bundle [$HELM_REPO_CA_FILE]
          --cert-file string                Identify HTTPS client using this SSL certificate file [$HELM_REPO_CERT_FILE]
          --check-helm-version              outputs either "2" or "3" indicating the current Helm major version
          --context-path string             ChartMuseum context path [$HELM_REPO_CONTEXT_PATH]
          --debug                           Enable verbose output
      -d, --dependency-update               update dependencies from "requirements.yaml" to dir "charts/" before packaging
      -f, --force                           Force upload even if chart version exists
      -h, --help                            help for helm
          --home string                     Location of your Helm config. Overrides $HELM_HOME (default "/root/.helm")
          --host string                     Address of Tiller. Overrides $HELM_HOST
          --insecure                        Connect to server with an insecure way by skipping certificate verification [$HELM_REPO_INSECURE]
          --key-file string                 Identify HTTPS client using this SSL key file [$HELM_REPO_KEY_FILE]
          --keyring string                  location of a public keyring (default "/root/.gnupg/pubring.gpg")
          --kube-context string             Name of the kubeconfig context to use
          --kubeconfig string               Absolute path of the kubeconfig file to be used
      -p, --password string                 Override HTTP basic auth password [$HELM_REPO_PASSWORD]
          --tiller-connection-timeout int   The duration (in seconds) Helm will wait to establish a connection to Tiller (default 300)
          --tiller-namespace string         Namespace of Tiller (default "kube-system")
      -t, --timeout int                     The duration (in seconds) Helm will wait to get response from chartmuseum (default 30)
      -u, --username string                 Override HTTP basic auth username [$HELM_REPO_USERNAME]
      -v, --version string                  Override chart version pre-push
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39

    原因为安装chartmuseum时指定的存储目录权限不够,需要给charts目录授权

    chmod 777 -R charts 
    [root@node-194 chart]# helm cm-push -f mysql-1.6.9.tgz chartmuseum
    Pushing mysql-1.6.9.tgz to chartmuseum...
    Done.
    
    • 1
    • 2
    • 3
    • 4
  • 相关阅读:
    Spring Data JPA 原理与实战第五天 Jackon相关使用
    javascript复习之旅 9.2初识到手写 javascript 中的 bind 函数
    文件I/O
    pojo之vo_dto_po的一些理解
    编码规范、git 规范
    旷世神作,腾讯高工手写13万字JDK源码笔记,从底层远吗 带你飙向实战
    spring6-国际化:i18n | 数据校验:Validation
    对象由生到死的一些过程
    国内券商有没有提供股票量化交易,程序化交易接口的,怎么用?
    vue项目中基于fabric 插件实现涂鸦画布功能
  • 原文地址:https://blog.csdn.net/qq_33196814/article/details/126261132