You are viewing documentation for a release that is no longer maintained. To view the documentation for the most recent version, see the latest RHACS docs.
第 4 章 使用 Helm chart 安装
4.1. 使用 Helm chart 快速安装
Red Hat Advanced Cluster Security for Kubernetes 在 OpenShift Container Platform 集群中安装一组服务。本节论述了在没有自定义的情况下在 OpenShift Container Platform 集群中安装 Red Hat Advanced Cluster Security for Kubernetes 的安装过程。
以下步骤代表了快速安装 Red Hat Advanced Cluster Security for Kubernetes 的高级别安装流程:
- 添加 Red Hat Advanced Cluster Security for Kubernetes Helm Chart 仓库。
-
安装
central-services
Helm Chart 来安装 集中组件 (Central 和 Scanner)。 - 生成 init 捆绑包。
-
安装
secured-cluster-services
Helm chart,以安装 per-cluster(针对每个集群)和per-node(针对每个节点)组件(Sensor、Admission Controller 和 Collector)。
安装前:
4.1.1. 添加 Helm Chart 仓库
流程
添加 Red Hat Advanced Cluster Security for Kubernetes charts 软件仓库。
$ helm repo add rhacs https://mirror.openshift.com/pub/rhacs/charts/
Red Hat Advanced Cluster Security for Kubernetes 的 Helm 仓库包括两个用于安装不同组件的 Helm chart。
用于安装集中组件(Central 和 Scanner)的中央服务Helm Chart(
central-services
)。注意您只部署集中式组件一次,并可使用同一安装监控多个独立集群。
安全集群服务 Helm Chart (
secured-cluster-services
) 用于安装针对每个集群(Sensor 和 Admission 控制器)和针对每个节点(Collector) 的组件。注意将 per-cluster 组件部署到要监控的每个集群中,并在要监控的所有节点中部署 per-node 组件。
验证
运行以下命令来验证添加的 chart 存储库:
$ helm search repo -l rhacs/
4.1.2. 在不自定义的情况下安装中央服务 Helm Chart
使用以下说明安装 central-services
Helm Chart 以部署集中组件(Central 和 Scanner)。
流程
运行以下命令安装 Central 服务并使用一个路由来公开 Central:
$ helm install -n stackrox \ --create-namespace stackrox-central-services rhacs/central-services \ --set imagePullSecrets.allowNone=true \ --set central.exposure.route.enabled=true
或者,运行以下命令安装 Central 服务并使用一个负载均衡器来公开 Central:
$ helm install -n stackrox \ --create-namespace stackrox-central-services rhacs/central-services \ --set imagePullSecrets.allowNone=true \ --set central.exposure.loadBalancer.enabled=true
或者,运行以下命令安装 Central 服务并使用一个端口转发来公开 Central:
$ helm install -n stackrox \ --create-namespace stackrox-central-services rhacs/central-services \ --set imagePullSecrets.allowNone=true
如果要在需要使用代理连接到外部服务的集群中安装 Red Hat Advanced Cluster Security for Kubernetes,则必须使用 proxyConfig
参数指定代理配置。例如:
env: proxyConfig: | url: http://proxy.name:port username: username password: password excludes: - some.domain
安装命令的输出包括:
- 自动生成的管理员密码。
- 关于存储所有配置值的说明。
- Helm 生成的任何警告。
4.1.3. 生成 init 捆绑包
在集群中安装 SecuredCluster
资源前,您必须创建一个 init 捆绑包。安装并配置 SecuredCluster
的集群,然后使用此捆绑包与 Central 进行身份验证。
4.1.3.1. 使用 roxctl CLI 生成 init 捆绑包
您可以使用 roxctl
CLI 创建带有 secret 的 init 捆绑包。
先决条件
您已配置了 ROX_API_TOKEN
和 ROX_CENTRAL_ADDRESS
环境变量。
设置
ROX_API_TOKEN
和ROX_CENTRAL_ADDRESS
环境变量:$ export ROX_API_TOKEN=<api_token>
$ export ROX_CENTRAL_ADDRESS=<address>:<port_number>
流程
运行以下命令以生成包含 secret 的集群 init 捆绑包:
$ roxctl -e "$ROX_CENTRAL_ADDRESS" \ central init-bundles generate <cluster_init_bundle_name> \ --output cluster_init_bundle.yaml
$ roxctl -e "$ROX_CENTRAL_ADDRESS" \ central init-bundles generate <cluster_init_bundle_name> \ --output-secrets cluster_init_bundle.yaml
请确定您安全地存储此捆绑包,因为它包含 secret。您可以使用同一捆绑包来设置多个安全集群。
4.1.4. 在不使用自定义配置的情况下安装 secured-cluster-services Helm chart
使用以下说明安装 secure-cluster-services
Helm chart,以部署 per-cluster 和 per-node 组件(Sensor、Admission Controller 和 Collector)。
要在具有统一可扩展固件接口(UEFI)以及启用了安全引导机制的系统中安装 Collector,您必须使用 eBPF 探测,因为内核模块没有被签名,且 UEFI 固件无法加载未签名的软件包。收集器在启动时用来识别安全引导状态,并切换到 eBPF 探测(如果需要)。
先决条件
- 您必须有用于公开 Central 服务的地址和端口号。
流程
在其他基于 Kubernetes 的集群上运行以下命令:
$ helm install -n stackrox --create-namespace \ stackrox-secured-cluster-services rhacs/secured-cluster-services \ -f <path_to_cluster_init_bundle.yaml> \ 1 --set clusterName=<name_of_the_secured_cluster> \ --set centralEndpoint=<endpoint_of_central_service> 2
在 OpenShift Container Platform 集群中运行以下命令:
$ helm install -n stackrox --create-namespace \ stackrox-secured-cluster-services rhacs/secured-cluster-services \ -f <path_to_cluster_init_bundle.yaml> \ 1 --set clusterName=<name_of_the_secured_cluster> \ --set centralEndpoint=<endpoint_of_central_service> 2 --set scanner.disable=false
4.1.5. 验证安装
完成安装后,运行几个存在安全漏洞的应用程序并进入 RHACS 门户来评估安全评估结果和策略违反结果。
以下部分中列出的示例应用程序包含关键漏洞,它们旨在验证 Red Hat Advanced Cluster Security for Kubernetes 的构建和部署时间评估功能。
验证安装:
根据您的暴露的方法查找 RHACS 门户地址:
对于路由:
$ oc get route central -n stackrox
对于负载均衡器:
$ oc get service central-loadbalancer -n stackrox
对于端口转发:
运行以下命令:
$ oc port-forward svc/central 18443:443 -n stackrox
-
进入到
https://localhost:18443/
。
使用 OpenShift Container Platform CLI 创建新项目:
$ oc new-project test
使用关键漏洞启动一些应用程序:
$ oc run shell --labels=app=shellshock,team=test-team \ --image=vulnerables/cve-2014-6271 -n test $ oc run samba --labels=app=rce \ --image=vulnerables/cve-2017-7494 -n test
Red Hat Advanced Cluster Security for Kubernetes 会在向集群提交后自动扫描这些部署以了解安全风险以及策略违反情况。进入 RHACS 门户以查看违反情况。您可以使用默认用户名 admin 和生成的密码登录到 RHACS 门户。