3.5.5. 镜像以在受限环境中运行管道


要在断开连接的集群或受限环境中置备的集群中运行 OpenShift Pipelines,请确保为受限网络配置了 Samples Operator,或者集群管理员创建了带有镜像 registry 的集群。

以下流程使用 pipelines-tutorial 示例,使用带有镜像 registry 的集群在受限环境中为应用程序创建管道。为确保 pipelines-tutorial 示例在受限环境中工作,您必须为前端接口(pipelines-vote-ui)后端接口(pipelines-vote-api)和 cli 从 mirror registry 中镜像相应的构建器镜像。

流程

  1. 为前端接口 pipelines-vote-ui 从 mirror registry 中镜像构建器镜像。

    1. 验证所需镜像标签没有导入:

      $ oc describe imagestream python -n openshift

      输出示例

      Name:			python
      Namespace:		openshift
      [...]
      
      3.8-ubi8 (latest)
        tagged from registry.redhat.io/ubi8/python-38:latest
          prefer registry pullthrough when referencing this tag
      
        Build and run Python 3.8 applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-python-container/blob/master/3.8/README.md.
        Tags: builder, python
        Supports: python:3.8, python
        Example Repo: https://github.com/sclorg/django-ex.git
      
      [...]

    2. 将支持的镜像标签镜像到私有 registry:

      $ oc image mirror registry.redhat.io/ubi8/python-38:latest <mirror-registry>:<port>/ubi8/python-38
    3. 导入镜像:

      $ oc tag <mirror-registry>:<port>/ubi8/python-38 python:latest --scheduled -n openshift

      您必须定期重新导入镜像。--scheduled 标志启用镜像自动重新导入。

    4. 验证带有指定标签的镜像已被导入:

      $ oc describe imagestream python -n openshift

      输出示例

      Name:			python
      Namespace:		openshift
      [...]
      
      latest
        updates automatically from registry <mirror-registry>:<port>/ubi8/python-38
      
        * <mirror-registry>:<port>/ubi8/python-38@sha256:3ee3c2e70251e75bfeac25c0c33356add9cc4abcbc9c51d858f39e4dc29c5f58
      
      [...]

  2. 为后端接口 pipelines-vote-api 从 mirror registry 中镜像构建器镜像。

    1. 验证所需镜像标签没有导入:

      $ oc describe imagestream golang -n openshift

      输出示例

      Name:			golang
      Namespace:		openshift
      [...]
      
      1.14.7-ubi8 (latest)
        tagged from registry.redhat.io/ubi8/go-toolset:1.14.7
          prefer registry pullthrough when referencing this tag
      
        Build and run Go applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.
        Tags: builder, golang, go
        Supports: golang
        Example Repo: https://github.com/sclorg/golang-ex.git
      
      [...]

    2. 将支持的镜像标签镜像到私有 registry:

      $ oc image mirror registry.redhat.io/ubi8/go-toolset:1.14.7 <mirror-registry>:<port>/ubi8/go-toolset
    3. 导入镜像:

      $ oc tag <mirror-registry>:<port>/ubi8/go-toolset golang:latest --scheduled -n openshift

      您必须定期重新导入镜像。--scheduled 标志启用镜像自动重新导入。

    4. 验证带有指定标签的镜像已被导入:

      $ oc describe imagestream golang -n openshift

      输出示例

      Name:			golang
      Namespace:		openshift
      [...]
      
      latest
        updates automatically from registry <mirror-registry>:<port>/ubi8/go-toolset
      
        * <mirror-registry>:<port>/ubi8/go-toolset@sha256:59a74d581df3a2bd63ab55f7ac106677694bf612a1fe9e7e3e1487f55c421b37
      
      [...]

  3. cli 的镜像 registry 中镜像构建器镜像。

    1. 验证所需镜像标签没有导入:

      $ oc describe imagestream cli -n openshift

      输出示例

      Name:                   cli
      Namespace:              openshift
      [...]
      
      latest
        updates automatically from registry quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:65c68e8c22487375c4c6ce6f18ed5485915f2bf612e41fef6d41cbfcdb143551
      
        * quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:65c68e8c22487375c4c6ce6f18ed5485915f2bf612e41fef6d41cbfcdb143551
      
      [...]

    2. 将支持的镜像标签镜像到私有 registry:

      $ oc image mirror quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:65c68e8c22487375c4c6ce6f18ed5485915f2bf612e41fef6d41cbfcdb143551 <mirror-registry>:<port>/openshift-release-dev/ocp-v4.0-art-dev:latest
    3. 导入镜像:

      $ oc tag <mirror-registry>:<port>/openshift-release-dev/ocp-v4.0-art-dev cli:latest --scheduled -n openshift

      您必须定期重新导入镜像。--scheduled 标志启用镜像自动重新导入。

    4. 验证带有指定标签的镜像已被导入:

      $ oc describe imagestream cli -n openshift

      输出示例

      Name:                   cli
      Namespace:              openshift
      [...]
      
      latest
        updates automatically from registry <mirror-registry>:<port>/openshift-release-dev/ocp-v4.0-art-dev
      
        * <mirror-registry>:<port>/openshift-release-dev/ocp-v4.0-art-dev@sha256:65c68e8c22487375c4c6ce6f18ed5485915f2bf612e41fef6d41cbfcdb143551
      
      [...]

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.