Alauda Security Service for StackRox 安装

本文档提供了安装 Alauda Security Service for StackRox 的分步说明。

安装要求

  • 架构:amd64
  • Kernel 版本:>=5.8
  • 资源要求:
    • CPU:>=4
    • Memory:>=8GB
  • PostgreSQL:>=13
  • TLS Certificate

下载并导入

  1. 从 portal 下载 Alauda Security Service for StackRox。

  2. 使用 Violet 工具将插件包上传到平台。

    violet push stackrox-operator.vx.x.x.tgz --platform-address https://192.168.0.1 --platform-username <user> --platform-password <password>

安装 StackRox Operator

  1. 登录平台并进入 Administrator 页面。

  2. 在左侧导航栏中,选择 Marketplace -> OperatorHub 进入 OperatorHub 页面。

  3. 找到 Alauda Security Service for StackRox,点击 Install 进入安装页面。

配置参数:

ParameterRecommended Configuration
Channel默认 Channel 为 alpha
Version选择要安装的目标版本。
Installation ModeCluster:集群中的所有 namespace 共享一个 Operator,用于创建和管理实例,从而降低资源使用。
Installation Location选择 Recommended:如果不存在,将自动创建。
Upgrade StrategyManual:当 OperatorHub 中有新版本可用时,需要手动确认后才能将 Operator 升级到最新版本。
  1. Install Operator 页面中,选择 Default Configuration,然后点击 Install 完成 Alauda Security Service for StackRox 的安装。

Central Service 安装

INFO

Central 服务的某些组件资源消耗较高。建议将它们运行在 infra 节点上,并设置 nodeSelector 和 tolerations,以确保它们仅在这些节点上运行。如果您正在评估产品且尚未配置 infra 节点,可以移除这些设置,使组件在所有节点上运行。

有关规划 infra 节点的指导,请参见 集群节点规划

安装前操作步骤

  1. 创建 central-db-password secret:
    将密码存储在 password 数据项中。

    kubectl create secret generic central-db-password \
      --from-literal=password=<central db password> \
      -n stackrox-operator
  2. 启用 Ingress 并配置域证书:
    使用您的证书和密钥创建一个 TLS secret。

    kubectl create secret tls central-ingress-tls \
      --cert=<path/to/tls.crt> \
      --key=<path/to/tls.key> \
      -n stackrox-operator

通过 UI 安装

  1. 登录平台并进入 Administrator 页面。

  2. 在左侧导航栏中,选择 Marketplace -> OperatorHub 进入 OperatorHub 页面。

  3. 找到 Alauda Security Service for StackRox,点击卡片进入 Details 页面。

  4. 进入 All Instances 选项卡,点击 Create 并选择 Central,进入 Create Central 页面。

  5. 按提示填写配置参数。

  6. 点击 Create 完成 Central Service 的安装。


通过 YAML 安装

将以下 YAML 应用到目标集群:

# YAML Deployment Method for StackRox Operator
# Create a StackRox Central Services instance
---
apiVersion: platform.stackrox.io/v1alpha1
kind: Central
metadata:
  name: stackrox-central-services
  namespace: stackrox-operator
  labels: {}
  annotations:
    cpaas.io/display-name: ""
spec:
  egress:
    connectivityPolicy: Online  # Supported: Online/Offline. Offline mode requires manual upload of the vulnerability database.
  central:
    exposure:
      ingress:
        enabled: true
        host: example.com
        tls:
          secretName: central-ingress-tls
      nodePort:
        enabled: true
      loadBalancer:
        enabled: false
    db:
      passwordSecret:
        name: central-db-password
      connectionString: host=central-db.stackrox port=5432 user=postgres sslmode=require  # Specify the database connection string

    # Tolerations are optional.
    # If you want this component to only run on specific nodes, you can configure tolerations of tainted nodes.
    tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/infra
        value: reserved
        operator: Equal
    nodeSelector:
      node-role.kubernetes.io/infra: ""
  

  # scannerV4 Optional
  scannerV4:
    db:
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/infra
          value: reserved
          operator: Equal

      nodeSelector:
        node-role.kubernetes.io/infra: ""

    indexer:
      scaling:
        autoScaling: Enabled
        maxReplicas: 5
        minReplicas: 2
        replicas: 3
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/infra
          value: reserved
          operator: Equal
      nodeSelector:
        node-role.kubernetes.io/infra: ""

    matcher:
      scaling:
        autoScaling: Enabled
        maxReplicas: 5
        minReplicas: 1
        replicas: 3
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/infra
          value: reserved
          operator: Equal
      nodeSelector:
        node-role.kubernetes.io/infra: ""

  # Ingress domain certificate CA or cert. If ingress is not enabled, no configuration is needed.
  tls:
    additionalCAs:
      - content: |-
          -----BEGIN CERTIFICATE-----
          MIIB0TCCAXigAwIBAgIUXvN2ovk16V6+7jUAJpYdEXo1K4UwCgYIKoZIzj0EAwIw
          RzEnMCUGA1UEAxMeU3RhY2tSb3ggQ2VydGlmaWNhdGUgQXV0aG9yaXR5MRwwGgYD
          VQQFExM2MDYyNzAwMjg3MTkxNjM0NDY4MB4XDTI1MDkyNTA2MjQwMFoXDTMwMDky
          NDA2MjQwMFowRzEnMCUGA1UEAxMeU3RhY2tSb3ggQ2VydGlmaWNhdGUgQXV0aG9y
          aXR5MRwwGgYDVQQFExM2MDYyNzAwMjg3MTkxNjM0NDY4MFkwEwYHKoZIzj0CAQYI
          KoZIzj0DAQcDQgAE57RYqus1/v3VcJ/fP+vG4flQ8uunyx2lguQ9cT0VYOZJnKDh
          FQ/58jgEPeHGgu+wU2Mvjumc7qFe1gP/jSuW66NCMEAwDgYDVR0PAQH/BAQDAgEG
          MA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKxLpgvy2HnDYZTQw2nIiLdR3fxh
          MAoGCCqGSM49BAMCA0cAMEQCID2uapFJnsdM4BGmnRCx7HqUrwrpBEjXZ98atcKO
          IDCXAiAwuYzXAIMLNfLRakIz+hXxvvGY3+A5ZeRARZQVPatTaQ==
          -----END CERTIFICATE-----
        name: additional-ca

Central 设置

ParameterDescription
central.nodeSelector如果 node selector 选择了有污点的节点,请使用此参数为 Central 指定污点容忍的 key、value 和 effect。此参数主要用于基础设施节点。
central.tolerations如果 node selector 选择了有污点的节点,请使用此参数为 Central 指定污点容忍的 key、value 和 effect。此参数主要用于基础设施节点。
central.exposeMonitoring指定为 true 可在 9090 端口上暴露 Central 的 Prometheus metrics endpoint。
central.image.registry自定义 registry,用于覆盖 Central 镜像的全局 image.registry 参数。
central.image.name自定义镜像名称,用于覆盖默认的 Central 镜像名称(main)。
central.image.tag自定义镜像 tag,用于覆盖 Central 镜像的默认 tag。如果您在新安装时指定了自己的镜像 tag,那么在升级到新版本时必须通过运行 helm upgrade 命令手动递增该 tag。如果您在自己的 registry 中镜像 Central 镜像,请不要修改原始镜像 tag。
central.image.fullRefCentral 镜像的完整引用,包括 registry 地址、镜像名称和镜像 tag。为此参数设置值将覆盖 central.image.registry、central.image.name 和 central.image.tag 参数。
central.resources.requests.memoryCentral 的 memory 请求。
central.resources.requests.cpuCentral 的 CPU 请求。
central.resources.limits.memoryCentral 的 memory 限制。
central.resources.limits.cpuCentral 的 CPU 限制。
central.exposure.loadBalancer.enabled使用 true 通过 load balancer 暴露 Central。
central.exposure.loadBalancer.port暴露 Central 的端口号。默认端口号为 443。
central.exposure.nodePort.enabled使用 true 通过 node port service 暴露 Central。
central.exposure.nodePort.port暴露 Central 的端口号。如果不设置此参数,平台会自动分配一个端口号。
central.exposure.ingress.enabled使用 true 通过 ingress 暴露 Central。若设置为 false,则会禁用所有 ingress 设置。
central.exposure.ingress.host使用此参数为 Central ingress 指定自定义 hostname。若不设置,则使用平台提供的默认值。
central.exposure.ingress.ingressClassName为 Central ingress 指定自定义 ingress class name。
central.exposure.ingress.tls.secretName使用 TLS secret 配置 Central ingress。
central.db.passwordSecret.name指定一个 secret,其中包含 password 数据项中的密码。
central.db.connectionString指定对应于由其他位置管理的数据库的 connection string。
scannerV4.db.tolerations如果您希望此组件仅在特定节点上运行,可以配置有污点节点的 tolerations。
scannerV4.db.nodeSelector如果您希望此组件仅在特定节点上运行,可以在此处配置 node selector。
scannerV4.indexer.scaling.autoScaling启用后,组件副本数量将根据负载在以下指定的限制范围内动态管理。
scannerV4.indexer.scaling.maxReplicas
scannerV4.indexer.scaling.minReplicas
scannerV4.indexer.scaling.replicas当自动扩缩容被禁用时,副本数量将始终配置为与此值一致。
scannerV4.indexer.tolerations如果您希望此组件仅在特定节点上运行,可以配置有污点节点的 tolerations。
scannerV4.indexer.nodeSelector如果您希望此组件仅在特定节点上运行,可以在此处配置 node selector。
scannerV4.matcher.scaling.autoScaling启用后,组件副本数量将根据负载在以下指定的限制范围内动态管理。
scannerV4.matcher.scaling.maxReplicas
scannerV4.matcher.scaling.minReplicas
scannerV4.matcher.scaling.replicas当自动扩缩容被禁用时,副本数量将始终配置为与此值一致。
scannerV4.matcher.tolerations如果您希望此组件仅在特定节点上运行,可以配置有污点节点的 tolerations。
scannerV4.matcher.nodeSelector如果您希望此组件仅在特定节点上运行,可以在此处配置 node selector。
tls.additionalCAs允许您指定额外的受信任 Root CAs。

访问 Central 控制台

  • Address: https://example.com(central ingress host 的地址)

  • Initial account: admin

  • Initial password: 初始密码位于 stackrox central-htpasswd secret 中。

    kubectl -n stackrox-operator get secret central-htpasswd -o go-template='{{index .data "password" | base64decode}}'

Cluster Service 安装

Cluster 安装前操作步骤

  1. 按照平台上的 Download CLI 指南下载 CLI 工具。

  2. 运行以下命令生成 cluster access certificate:

    roxctl central crs generate <cluster name> --output crs.yaml --endpoint <stackrox central address> --password <central admin password>

    密码可从 central-htpasswd secret 中获取。

  3. 创建 Secured Cluster CRs YAML

    kubectl apply -f crs.yaml -n stackrox-operator

通过 UI 安装 Cluster

  1. 登录平台并进入 Administrator 页面。

  2. 在左侧导航栏中,选择 Marketplace -> OperatorHub 进入 OperatorHub 页面。

  3. 找到 Alauda Security Service for StackRox,点击卡片进入 Details 页面。

  4. 进入 All Instances 选项卡,点击 Create 并选择 Central,进入 Create Cluster Service 页面。

  5. 按提示填写配置参数。

  6. 点击 Create 完成 Cluster Service 的安装。


通过 YAML 安装 Cluster

将以下 YAML 应用到目标集群:

---
# Create a StackRox Secured Cluster Services instance
---
apiVersion: platform.stackrox.io/v1alpha1
kind: SecuredCluster
metadata:
  name: stackrox-secured-cluster-services
  namespace: stackrox-operator
  labels: {}
  annotations:
    cpaas.io/display-name: ""
spec:
  clusterName: business-1
  centralEndpoint: wss://example.com:443  # Specify the address of StackRox Central Services. If it is in the same cluster as Central, configuration may not be necessary.

  # AdmissionControl is optional.
  admissionControl:
    replicas: 3
    tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/infra
        value: reserved
        operator: Equal
    nodeSelector:
      node-role.kubernetes.io/infra: ""

  # Sensor is optional.
  sensor:
    tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/infra
        value: reserved
        operator: Equal
    nodeSelector:
      node-role.kubernetes.io/infra: ""

  # Ingress domain certificate CA or cert. If ingress is not enabled, no configuration is needed.
  tls:
    additionalCAs:
      - content: |-
          -----BEGIN CERTIFICATE-----
          MIIB0TCCAXigAwIBAgIUXvN2ovk16V6+7jUAJpYdEXo1K4UwCgYIKoZIzj0EAwIw
          RzEnMCUGA1UEAxMeU3RhY2tSb3ggQ2VydGlmaWNhdGUgQXV0aG9yaXR5MRwwGgYD
          VQQFExM2MDYyNzAwMjg3MTkxNjM0NDY4MB4XDTI1MDkyNTA2MjQwMFoXDTMwMDky
          NDA2MjQwMFowRzEnMCUGA1UEAxMeU3RhY2tSb3ggQ2VydGlmaWNhdGUgQXV0aG9y
          aXR5MRwwGgYDVQQFExM2MDYyNzAwMjg3MTkxNjM0NDY4MFkwEwYHKoZIzj0CAQYI
          KoZIzj0DAQcDQgAE57RYqus1/v3VcJ/fP+vG4flQ8uunyx2lguQ9cT0VYOZJnKDh
          FQ/58jgEPeHGgu+wU2Mvjumc7qFe1gP/jSuW66NCMEAwDgYDVR0PAQH/BAQDAgEG
          MA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKxLpgvy2HnDYZTQw2nIiLdR3fxh
          MAoGCCqGSM49BAMCA0cAMEQCID2uapFJnsdM4BGmnRCx7HqUrwrpBEjXZ98atcKO
          IDCXAiAwuYzXAIMLNfLRakIz+hXxvvGY3+A5ZeRARZQVPatTaQ==
          -----END CERTIFICATE-----
        name: additional-ca
 

Secured Cluster 设置

ParameterDescription
clusterName此集群的唯一名称,将显示在 Central UI 中。一旦在此处设置名称,之后将无法更改。如需使用不同名称注册集群,请删除并重新创建此对象。
centralEndpoint要连接的 Central 实例的 endpoint,包括端口号。如果未指定端口且 endpoint 包含 https:// 协议说明,则默认使用端口 443。如果您使用的是不支持 gRPC 的 load balancer,请在 endpoint 地址前添加 wss://,以使用 WebSocket 协议。留空时,Sensor 会尝试连接到运行在同一 namespace 中的 Central 实例。
admissionControl.replicasadmission control pod 的副本数量。
admissionControl.tolerations如果您希望此组件仅在特定节点上运行,可以配置有污点节点的 tolerations。
admissionControl.nodeSelector如果您希望此组件仅在特定节点上运行,可以在此处配置 node selector。
sensor.tolerations如果您希望此组件仅在特定节点上运行,可以配置有污点节点的 tolerations。
sensor.nodeSelector如果您希望此组件仅在特定节点上运行,可以在此处配置 node selector。
tls.additionalCAs允许您指定额外的受信任 Root CAs。