5.3. 安装 Central


Red Hat Advanced Cluster Security for Kubernetes 的主要组件名为 Central。您可以使用交互式安装程序在 OpenShift Container Platform 上安装 Central。您只需要部署 Central 一次,并使用同一安装监控多个独立集群。

5.3.1. 使用交互式安装程序

使用交互式安装程序为您的环境生成所需的 secret、部署配置和部署脚本。

流程

  1. 运行交互式 install 命令:

    $ roxctl central generate interactive
    Copy to Clipboard Toggle word wrap
    重要

    使用 roxctl CLI 安装 Red Hat Advanced Cluster Security for Kubernetes 会默认创建 PodSecurityPolicy (PSP)对象,以向后兼容。如果在 Kubernetes 版本 1.25 及更新版本或 OpenShift Container Platform 版本 4.12 及更新版本上安装 RHACS,则必须禁用 PSP 对象创建。要做到这一点,为 roxctl central generateroxctl sensor generate 命令将 --enable-pod-security-policies 选项指定为 false

  2. Enter 接受提示的默认值或根据需要输入自定义值。

    Enter path to the backup bundle from which to restore keys and certificates (optional):
    Enter PEM cert bundle file (optional): 
    1
    
    Enter administrator password (default: autogenerated):
    Enter orchestrator (k8s, openshift): openshift
    Enter the directory to output the deployment bundle to (default: "central-bundle"):
    Enter the OpenShift major version (3 or 4) to deploy on (default: "0"): 4
    Enter Istio version when deploying into an Istio-enabled cluster (leave empty when not running Istio) (optional):
    Enter the method of exposing Central (route, lb, np, none) (default: "none"): route 
    2
    
    Enter main image to use (default: "stackrox.io/main:3.0.61.1"):
    Enter whether to run StackRox in offline mode, which avoids reaching out to the Internet (default: "false"):
    Enter whether to enable telemetry (default: "true"):
    Enter the deployment tool to use (kubectl, helm, helm-values) (default: "kubectl"):
    Enter Scanner DB image to use (default: "stackrox.io/scanner-db:2.15.2"):
    Enter Scanner image to use (default: "stackrox.io/scanner:2.15.2"):
    Enter Central volume type (hostpath, pvc): pvc 
    3
    
    Enter external volume name (default: "stackrox-db"):
    Enter external volume size in Gi (default: "100"):
    Enter storage class name (optional if you have a default StorageClass configured):
    Copy to Clipboard Toggle word wrap
    1
    如果要添加自定义 TLS 证书,请提供 PEM 编码证书的文件路径。当您指定自定义证书时,交互式安装程序还会提示您为您要使用的自定义证书提供 PEM 私钥。
    2
    要使用 RHACS 门户,您必须使用路由(负载均衡器或节点端口)公开中。
    3
    如果您计划在带有 hostPath 卷的 OpenShift Container Platform 上安装 Red Hat Advanced Cluster Security for Kubernetes,您必须修改 SELinux 策略。
    警告

    在 OpenShift Container Platform 中,对于 hostPath 卷,您必须修改 SELinux 策略以允许访问主机和容器共享的目录。这是因为 SELinux 默认阻止目录共享。要修改 SELinux 策略,请运行以下命令:

    $ sudo chcon -Rt svirt_sandbox_file_t <full_volume_path>
    Copy to Clipboard Toggle word wrap

    但是,红帽不推荐修改 SELinux 策略,在 OpenShift Container Platform 上安装时使用 PVC。

在完成时,安装程序会创建一个名为 central-bundle 的文件夹,其中包含用于部署 Central 所需的 YAML 清单和脚本。另外,它显示了您需要运行的脚本的屏幕说明,以部署其他可信证书颁发机构、中部和扫描器,以及登录 RHACS 门户的身份验证说明(如果您回答提示时未提供密码)。

5.3.2. 运行中央安装脚本

运行交互式安装程序后,您可以运行 setup.sh 脚本来安装 Central。

流程

  1. 运行 setup.sh 脚本来配置镜像 registry 访问:

    $ ./central-bundle/central/scripts/setup.sh
    Copy to Clipboard Toggle word wrap
  2. 创建所需资源:

    $ oc create -R -f central-bundle/central
    Copy to Clipboard Toggle word wrap
  3. 检查部署进度:

    $ oc get pod -n stackrox -w
    Copy to Clipboard Toggle word wrap
  4. 在 Central 运行后,找到 RHACS 门户 IP 地址并在浏览器中打开。根据您在回答提示时选择的风险,请使用以下方法之一获取 IP 地址。

    Expand
    公开方法命令地址Example

    Route(路由)

    oc -n stackrox get route central

    在输出中 HOST/PORT 列下的地址

    https://central-stackrox.example.route

    节点端口

    oc get node -owide && oc -n stackrox get svc central-loadbalancer

    任何节点的 IP 或主机名,在服务显示的端口中

    https://198.51.100.0:31489

    Load Balancer

    oc -n stackrox get svc central-loadbalancer

    在端口 443 上为服务显示 EXTERNAL-IP 或主机名

    https://192.0.2.0

    central-bundle/central/scripts/port-forward.sh 8443

    https://localhost:8443

    https://localhost:8443

注意

如果您在互动安装过程中选择了自动生成的密码,您可以运行以下命令将其记录到 Central:

$ cat central-bundle/password
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat