5.4. 管理 Gatekeeper operator 安装策略


使用 Red Hat Advanced Cluster Management 策略在受管集群上安装 Gatekeeper operator 和 Gatekeeper。

需要的访问权限: 集群管理员

要创建、查看和更新 Gatekeeper Operator 安装策略,请完成以下部分:

5.4.1. 使用 Gatekeeper operator 策略安装 Gatekeeper

要安装 Gatekeeper operator 策略,请使用配置策略控制器。在安装过程中,operator 组和订阅会拉取 Gatekeeper operator 将其安装到受管集群中。然后,策略会创建一个 Gatekeeper 自定义资源来配置 Gatekeeper。

Red Hat Advanced Cluster Management 配置策略控制器检查 Gatekeeper operator 策略,并支持 enforce 补救操作。当您将控制器设置为 强制 时,它会在受管集群上自动创建 Gatekeeper operator 对象。

5.4.2. 从控制台创建 Gatekeeper 策略

从控制台创建 Gatekeeper 策略时,您必须将补救 enforce 设置为安装 Gatekeeper。

5.4.2.1. 查看 Gatekeeper operator 策略

要在控制台中查看您的 Gatekeeper operator 策略及其状态,请完成以下步骤:

  1. 选择 policy-gatekeeper-operator 策略来查看更多详细信息。
  2. 选择 Clusters 选项卡来查看策略违反情况。

5.4.3. 升级 Gatekeeper 和 Gatekeeper operator

您可以升级 Gatekeeper 和 Gatekeeper operator 的版本。当使用 Gatekeeper operator 策略安装 Gatekeeper operator 时,请注意 upgradeApproval 的值。当您将 upgradeApproval 设置为 Automatic 时,Operator 会自动升级。

如果将 upgradeApproval 设置为 Manual,则必须为每个安装 Gatekeeper operator 的集群手动批准升级。

5.4.4. 禁用 Gatekeeper operator 策略

要禁用 policy-gatekeeper-operator 策略,请从控制台的 Actions 菜单中选择 Disable 选项,或者从 CLI 设置 spec.disabled: true

5.4.5. 删除 Gatekeeper operator 策略

要从 CLI 删除 Gatekeeper operator 策略,请完成以下步骤:

  1. 运行以下命令来删除 Gatekeeper operator 策略:

    oc delete policies.policy.open-cluster-management.io <policy-gatekeeper-operator-name> -n <namespace>
  2. 运行以下命令验证您是否删除了您的策略:

    oc get policies.policy.open-cluster-management.io <policy-gatekeeper-operator-name> -n <namespace>

要从控制台删除 Gatekeeper operator 策略,点 policy-gatekeeper-operator 策略的 Actions 图标,然后选择 Delete

5.4.6. 卸载 Gatekeeper 约束、Gatekeeper 实例和 Gatekeeper operator 策略

要卸载 Gatekeeper 策略,请完成以下部分中的步骤:

5.4.6.1. 删除 Gatekeeper 约束

要从受管集群中删除 Gatekeeper 约束和 ConstraintTemplate,请完成以下步骤:

  1. 编辑 Gatekeeper 约束或 ConstraintTemplate 策略。
  2. 找到用于创建 Gatekeeper ConstraintConstraintTemplate 的模板。
  3. 从模板列表中删除条目。(如果策略是唯一的模板,则删除该策略。)
  4. 保存并应用策略。

注: constraint 和 ConstraintTemplate 直接在 policy-templates 中提供,而不是在 ConfigurationPolicy 中提供。

5.4.6.2. 删除 Gatekeeper 实例

要从受管集群中删除 Gatekeeper 实例,请完成以下步骤:

  1. 编辑 Gatekeeper operator 策略。
  2. 找到用于创建 Gatekeeper operator 自定义资源的 ConfigurationPolicy 模板。
  3. ConfigurationPolicy 模板的 complianceType 的值改为 mustnothave。更改值会删除 Gatekeeper operator 自定义资源,信号到 Gatekeeper operator 来清理 Gatekeeper 部署。

5.4.6.3. 删除 Gatekeeper operator

要从受管集群中删除 Gatekeeper Operator,请完成以下步骤:

  1. 编辑 Gatekeeper operator 策略。
  2. 找到用于创建 Subscription CR 的 OperatorPolicy 模板。
  3. OperatorPolicy 模板的 complianceType 的值改为 mustnothave

5.4.7. 其他资源

如需了解更多详细信息,请参阅以下资源:

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.