2.3. 使用 CLI 安装 Red Hat OpenShift GitOps Operator


您可以使用 CLI 从 OperatorHub 安装 Red Hat OpenShift GitOps Operator。

流程

  1. 创建一个 Subscription 对象 YAML 文件,以便为 Red Hat OpenShift GitOps 订阅一个命名空间,如 sub.yaml

    订阅示例

    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: openshift-gitops-operator
      namespace: openshift-operators
    spec:
      channel: latest 
    1
    
      installPlanApproval: Automatic
      name: openshift-gitops-operator 
    2
    
      source: redhat-operators 
    3
    
      sourceNamespace: openshift-marketplace 
    4
    Copy to Clipboard Toggle word wrap

    1
    指定您要订阅 Operator 的频道名称。
    2
    指定要订阅的 Operator 的名称。
    3
    指定提供 Operator 的 CatalogSource 的名称。
    4
    CatalogSource 的命名空间。将 openshift-marketplace 用于默认的 OperatorHub CatalogSource。
  2. 订阅应用到集群:

    $ oc apply -f openshift-gitops-sub.yaml
    Copy to Clipboard Toggle word wrap
  3. 安装完成后,确保 openshift-gitops 命名空间中的所有 pod 都在运行:

    $ oc get pods -n openshift-gitops
    Copy to Clipboard Toggle word wrap

    输出示例

    NAME                                                      	READY   STATUS	RESTARTS   AGE
    cluster-b5798d6f9-zr576                                   	1/1 	Running   0      	65m
    kam-69866d7c48-8nsjv                                      	1/1 	Running   0      	65m
    openshift-gitops-application-controller-0                 	1/1 	Running   0      	53m
    openshift-gitops-applicationset-controller-6447b8dfdd-5ckgh 1/1 	Running   0      	65m
    openshift-gitops-redis-74bd8d7d96-49bjf                   	1/1 	Running   0      	65m
    openshift-gitops-repo-server-c999f75d5-l4rsg              	1/1 	Running   0      	65m
    openshift-gitops-server-5785f7668b-wj57t                  	1/1 	Running   0      	53m
    Copy to Clipboard Toggle word wrap

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat