Environment  环境

Rancher, RKE2, SUSE Application Collection,Helm, OCI chart repository
Rancher、RKE2、SUSE Application Collection、Helm、OCI 图表仓库

Situation  地理位置

When attempting to automate the deployment of SUSE Application Collection products using the Rancher API object "HelmChart," the deployment fails. The user has configured the Repository Suse App Collection with a Suse service account and is trying to use a HelmChart YAML file to deploy applications. The initial attempt with the oci// scheme fails, indicating that the scheme is not supported. 
当尝试使用 Rancher API 对象“HelmChart”自动化部署 SUSE 应用集合产品时,部署失败。用户已用 Suse 服务账户配置了仓库 Suse 应用集合,并试图使用 HelmChart 的 YAML 文件来部署应用程序。对 oci// 方案的初步尝试失败,表明该方案不被支持。

Error: looks like "oci://dp.apps.rancher.io/charts"" is not a valid chart repository or cannot be reached: failed to perform "FetchReference" on source: invalid reference

Switching to https results in a 401 Unauthorized error. 
切换到 https 会触发 401 未授权错误。

Error: looks like "https://dp.apps.rancher.io/charts"" is not a valid chart repository or cannot be reached: failed to fetch https://dp.apps.rancher.io/charts/index.yaml : 401 Unauthorized
Resolution  结局

 Adding the proper parameters for the OCI chart and secrets resolved the issue.
添加了合适的 OCI 图表和秘密参数后问题就解决了。

 

  1. Configure the OCI chart repository directly in the HelmChart YAML file as specified in the example application(redis).
    按照示例应用程序(redis)中指定的,直接在 HelmChart YAML 文件中配置 OCI 图表仓库。
  2. Create a single docker registry secret in the kube-system namespace for pulling the Helm chart.
    在 kube 系统命名空间创建一个 docker 注册表秘密,用于拉取 Helm 图表。
  3. Create a secret in each application namespace for pulling specific images from the app collection.
    在每个应用命名空间创建一个秘密,用于从应用集合中提取特定图片。

Note: Both secrets dockerRegistrySecret and imagePullSecrets are docker registry secrets
注意:dockerRegistrySecret 和 imagePullSecrets 这两个秘密都是 docker 注册表秘密

Here is an example application(redis) YAML configuration:
这里是一个示例应用(redis)YAML 配置:

apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
  name: redis
  namespace: kube-system
spec:
  chart: oci://dp.apps.rancher.io/charts/redis
  version: 2.3.0
  targetNamespace: appnamespace
  dockerRegistrySecret:
    name: helm-oci-registry
  valuesContent: |-
    global:
      imagePullSecrets:
        - name: application-collection
    persistence:
      enabled: false
Cause  病因

The primary cause of the issue is the incorrect configuration of the HelmChart YAML file for deploying applications from the SUSE Application Collection.
问题的主要原因是 HelmChart YAML 文件在部署 SUSE 应用集合中的应用程序配置错误。

访问Rancher-K8S解决方案博主,企业合作伙伴 :
https://blog.csdn.net/lidw2009

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐