5.3. 安装 Central
Red Hat Advanced Cluster Security for Kubernetes 的主要组件名为 Central。您可以使用交互式安装程序在 OpenShift Container Platform 上安装 Central。您只需要部署 Central 一次,并使用同一安装监控多个独立集群。
5.3.1. 使用交互式安装程序 复制链接链接已复制到粘贴板!
使用交互式安装程序为您的环境生成所需的 secret、部署配置和部署脚本。
流程
运行交互式 install 命令:
roxctl central generate interactive
$ roxctl central generate interactiveCopy to Clipboard Copied! Toggle word wrap Toggle overflow 按 Enter 接受提示的默认值或根据需要输入自定义值。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 警告在 OpenShift Container Platform 中,对于 hostPath 卷,您必须修改 SELinux 策略以允许访问主机和容器共享的目录。这是因为 SELinux 默认阻止目录共享。要修改 SELinux 策略,请运行以下命令:
sudo chcon -Rt svirt_sandbox_file_t <full_volume_path>
$ sudo chcon -Rt svirt_sandbox_file_t <full_volume_path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 但是,红帽不推荐修改 SELinux 策略,在 OpenShift Container Platform 上安装时使用 PVC。
在完成时,安装程序会创建一个名为 central-bundle 的文件夹,其中包含用于部署 Central 所需的 YAML 清单和脚本。另外,它显示了您需要运行的脚本的屏幕说明,以部署其他可信证书颁发机构、中部和扫描器,以及登录 RHACS 门户的身份验证说明(如果您回答提示时未提供密码)。
5.3.2. 运行中央安装脚本 复制链接链接已复制到粘贴板!
运行交互式安装程序后,您可以运行 setup.sh 脚本来安装 Central。
流程
运行
setup.sh脚本来配置镜像 registry 访问:./central-bundle/central/scripts/setup.sh
$ ./central-bundle/central/scripts/setup.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow 创建所需资源:
oc create -R -f central-bundle/central
$ oc create -R -f central-bundle/centralCopy to Clipboard Copied! Toggle word wrap Toggle overflow 检查部署进度:
oc get pod -n stackrox -w
$ oc get pod -n stackrox -wCopy to Clipboard Copied! Toggle word wrap Toggle overflow 在 Central 运行后,找到 RHACS 门户 IP 地址并在浏览器中打开。根据您在回答提示时选择的风险,请使用以下方法之一获取 IP 地址。
Expand 公开方法 命令 地址 示例 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:31489Load Balancer
oc -n stackrox get svc central-loadbalancer在端口 443 上为服务显示 EXTERNAL-IP 或主机名
https://192.0.2.0无
central-bundle/central/scripts/port-forward.sh 8443https://localhost:8443https://localhost:8443
如果您在互动安装过程中选择了自动生成的密码,您可以运行以下命令将其记录到 Central:
cat central-bundle/password
$ cat central-bundle/password