搜索

7.4. 启用安全配置集 Operator

download PDF

在使用 Security Profiles Operator 之前,您必须确保在集群中部署 Operator。

重要

Security Profiles Operator 仅支持 Red Hat Enterprise Linux CoreOS (RHCOS) worker 节点。不支持 Red Hat Enterprise Linux (RHEL) 节点。

重要

Security Profiles Operator 只支持 x86_64 架构。

7.4.1. 安装 Security Profiles Operator

先决条件

  • 您必须具有 admin 权限。

流程

  1. 在 OpenShift Container Platform Web 控制台中导航至 Operators OperatorHub
  2. 搜索 Security Profiles Operator,然后点 Install
  3. 保留安装模式命名空间的默认选择,以确保将 Operator 安装到 openshift-security-profiles 命名空间中。
  4. Install

验证

确认安装成功:

  1. 导航到 Operators Installed Operators 页面。
  2. 检查 Security Profiles Operator 是否在 openshift-security-profiles 命名空间中安装,其状态是否为 Succeeded

如果 Operator 没有成功安装:

  1. 导航到 Operators Installed Operators 页面,并检查 Status 列中是否有任何错误或故障。
  2. 进入到 Workloads Pods 页面,检查 openshift-security-profiles 项目中报告问题的 pod 的日志。

7.4.2. 使用 CLI 安装 Security Profiles Operator

先决条件

  • 您必须具有 admin 权限。

流程

  1. 定义一个 Namespace 对象:

    namespace-object.yaml示例

    apiVersion: v1
    kind: Namespace
    metadata:
        name: openshift-security-profiles
    labels:
      openshift.io/cluster-monitoring: "true"

  2. 创建 Namespace 对象:

    $ oc create -f namespace-object.yaml
  3. 定义一个 OperatorGroup 对象:

    operator-group-object.yaml示例

    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: security-profiles-operator
      namespace: openshift-security-profiles

  4. 创建 OperatorGroup 对象:

    $ oc create -f operator-group-object.yaml
  5. 定义一个 Subscription 对象:

    subscription-object.yaml示例

    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: security-profiles-operator-sub
      namespace: openshift-security-profiles
    spec:
      channel: release-alpha-rhel-8
      installPlanApproval: Automatic
      name: security-profiles-operator
      source: redhat-operators
      sourceNamespace: openshift-marketplace

  6. 创建 Subscription 对象:

    $ oc create -f subscription-object.yaml
注意

如果要设置全局调度程序功能并启用 defaultNodeSelector,您必须手动创建命名空间并更新 openshift-security-profiles 命名空间的注解,或安装 Security Profiles Operator 的命名空间,使用 openshift.io/node-selector: ""。这会删除默认节点选择器并防止部署失败。

验证

  1. 通过检查以下 CSV 文件来验证安装是否成功:

    $ oc get csv -n openshift-security-profiles
  2. 运行以下命令,验证 Security Profiles Operator 是否正常工作:

    $ oc get deploy -n openshift-security-profiles

7.4.3. 配置日志记录详细程度

Security Profiles Operator 支持默认日志记录详细程度 0,以及更加详细的 1

流程

  • 要启用增强的日志详细程度,请运行以下命令来修补 spod 配置并调整值:

    $ oc -n openshift-security-profiles patch spod \
        spod --type=merge -p '{"spec":{"verbosity":1}}'

    输出示例

    securityprofilesoperatordaemon.security-profiles-operator.x-k8s.io/spod patched

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.