3.4. Upgrading all secured clusters


After upgrading Central services, you must upgrade all secured clusters.

重要
  • If you are using automatic upgrades:

  • If you are not using automatic upgrades, you must run the instructions in this section on all secured clusters including the Central cluster.

    • To ensure optimal functionality, use the same RHACS version for your secured clusters and the cluster on which Central is installed.

To complete manual upgrades of each secured cluster running Sensor, Collector, and Admission controller, follow the instructions in this section.

3.4.1. Updating other images

You must update the sensor, collector and compliance images on each secured cluster when not using automatic upgrades.

注意

If you are using Kubernetes, use kubectl instead of oc for the commands listed in this procedure.

Procedure

  1. Update the Sensor image:

    $ oc -n stackrox set image deploy/sensor sensor=registry.redhat.io/advanced-cluster-security/rhacs-main-rhel8:4.7.8
  2. Update the Compliance image:

    $ oc -n stackrox set image ds/collector compliance=registry.redhat.io/advanced-cluster-security/rhacs-main-rhel8:4.7.8
  3. Update the Collector image:

    $ oc -n stackrox set image ds/collector collector=registry.redhat.io/advanced-cluster-security/rhacs-collector-rhel8:4.7.8
  4. Update the admission control image:

    $ oc -n stackrox set image deploy/admission-control admission-control=registry.redhat.io/advanced-cluster-security/rhacs-main-rhel8:4.7.8
    重要

    If you have installed RHACS on Red Hat OpenShift by using the roxctl CLI, you need to migrate the security context constraints (SCCs).

    For more information, see "Migrating SCCs during the manual upgrade" in the "Additional resources" section.

When upgrading to version 4.6 or later from a version earlier than 4.6, you must patch the sensor and admission-control deployments to set the POD_NAMESPACE environment variable.

注意

If you are using Kubernetes, use kubectl instead of oc for the commands listed in this procedure.

Procedure

  1. Patch sensor to ensure POD_NAMESPACE is set by running the following command:

    $ [[ -z "$(oc -n stackrox get deployment sensor -o yaml | grep POD_NAMESPACE)" ]] && oc -n stackrox patch deployment sensor --type=json -p '[{"op":"add","path":"/spec/template/spec/containers/0/env/-","value":{"name":"POD_NAMESPACE","valueFrom":{"fieldRef":{"fieldPath":"metadata.namespace"}}}}]'
  2. Patch admission-control to ensure POD_NAMESPACE is set by running the following command:

    $ [[ -z "$(oc -n stackrox get deployment admission-control -o yaml | grep POD_NAMESPACE)" ]] && oc -n stackrox patch deployment admission-control --type=json -p '[{"op":"add","path":"/spec/template/spec/containers/0/env/-","value":{"name":"POD_NAMESPACE","valueFrom":{"fieldRef":{"fieldPath":"metadata.namespace"}}}}]'

3.4.3. Migrating SCCs during the manual upgrade

By migrating the security context constraints (SCCs) during the manual upgrade by using roxctl CLI, you can seamlessly transition the Red Hat Advanced Cluster Security for Kubernetes (RHACS) services to use the Red Hat OpenShift SCCs, ensuring compatibility and optimal security configurations across Central and all secured clusters.

Procedure

  1. List all of the RHACS services that are deployed on Central and all secured clusters:

    $ oc -n stackrox describe pods | grep 'openshift.io/scc\|^Name:'

    Example output

    Name:      admission-control-6f4dcc6b4c-2phwd
               openshift.io/scc: stackrox-admission-control
    #...
    Name:      central-575487bfcb-sjdx8
               openshift.io/scc: stackrox-central
    Name:      central-db-7c7885bb-6bgbd
               openshift.io/scc: stackrox-central-db
    Name:      collector-56nkr
               openshift.io/scc: stackrox-collector
    #...
    Name:      scanner-68fc55b599-f2wm6
               openshift.io/scc: stackrox-scanner
    Name:      scanner-68fc55b599-fztlh
    #...
    Name:      sensor-84545f86b7-xgdwf
               openshift.io/scc: stackrox-sensor
    #...

    In this example, you can see that each pod has its own custom SCC, which is specified through the openshift.io/scc field.

  2. Add the required roles and role bindings to use the Red Hat OpenShift SCCs instead of the RHACS custom SCCs.

    To add the required roles and role bindings to use the Red Hat OpenShift SCCs for the Central cluster, complete the following steps:

    1. Create a file named update-central.yaml that defines the role and role binding resources by using the following content:

      例 3.1. Example YAML file

      apiVersion: rbac.authorization.k8s.io/v1
      kind: Role #
      metadata:
        annotations:
           email: support@stackrox.com
           owner: stackrox
        labels:
           app.kubernetes.io/component: central
           app.kubernetes.io/instance: stackrox-central-services
           app.kubernetes.io/name: stackrox
           app.kubernetes.io/part-of: stackrox-central-services
           app.kubernetes.io/version: 4.4.0
        name: use-central-db-scc #
        namespace: stackrox #
      Rules: #
      - apiGroups:
        - security.openshift.io
        resourceNames:
        - nonroot-v2
        resources:
        - securitycontextconstraints
        verbs:
        - use
      - - -
      apiVersion: rbac.authorization.k8s.io/v1
      kind: Role
      metadata:
        annotations:
           email: support@stackrox.com
           owner: stackrox
        labels:
           app.kubernetes.io/component: central
           app.kubernetes.io/instance: stackrox-central-services
           app.kubernetes.io/managed-by: Helm
           app.kubernetes.io/name: stackrox
           app.kubernetes.io/part-of: stackrox-central-services
           app.kubernetes.io/version: 4.4.0
        name: use-central-scc
        namespace: stackrox
      rules:
      - apiGroups:
        - security.openshift.io
        resourceNames:
        - nonroot-v2
        resources:
        - securitycontextconstraints
        verbs:
        - use
      - - -
      apiVersion: rbac.authorization.k8s.io/v1
      kind: Role
      metadata:
        annotations:
           email: support@stackrox.com
           owner: stackrox
        labels:
           app.kubernetes.io/component: scanner
           app.kubernetes.io/instance: stackrox-central-services
           app.kubernetes.io/name: stackrox
           app.kubernetes.io/part-of: stackrox-central-services
           app.kubernetes.io/version: 4.4.0
        name: use-scanner-scc
        namespace: stackrox
      rules:
      - apiGroups:
        - security.openshift.io
        resourceNames:
        - nonroot-v2
        resources:
        - securitycontextconstraints
        verbs:
        - use
      - - -
      apiVersion: rbac.authorization.k8s.io/v1
      kind: RoleBinding #
      metadata:
        annotations:
           email: support@stackrox.com
           owner: stackrox
        labels:
           app.kubernetes.io/component: central
           app.kubernetes.io/instance: stackrox-central-services
           app.kubernetes.io/name: stackrox
           app.k ubernetes.io/part-of: stackrox-central-services
           app.kubernetes.io/version: 4.4.0
        name: central-db-use-scc #
        namespace: stackrox
      roleRef: #
        apiGroup: rbac.authorization.k8s.io
        kind: Role
        name: use-central-db-scc
      subjects: #
      - kind: ServiceAccount
        name: central-db
        namespace: stackrox
      - - -
      apiVersion: rbac.authorization.k8s.io/v1
      kind: RoleBinding
      metadata:
        annotations:
           email: support@stackrox.com
           owner: stackrox
        labels:
           app.kubernetes.io/component: central
           app.kubernetes.io/instance: stackrox-central-services
           app.kubernetes.io/name: stackrox
           app.kubernetes.io/part-of: stackrox-central-services
           app.kubernetes.io/version: 4.4.0
        name: central-use-scc
        namespace: stackrox
      roleRef:
        apiGroup: rbac.authorization.k8s.io
        kind: Role
        name: use-central-scc
      subjects:
      - kind: ServiceAccount
        name: central
        namespace: stackrox
      - - -
      apiVersion: rbac.authorization.k8s.io/v1
      kind: RoleBinding
      metadata:
        annotations:
           email: support@stackrox.com
           owner: stackrox
        labels:
           app.kubernetes.io/component: scanner
           app.kubernetes.io/instance: stackrox-central-services
           app.kubernetes.io/name: stackrox
           app.kubernetes.io/part-of: stackrox-central-services
           app.kubernetes.io/version: 4.4.0
        name: scanner-use-scc
        namespace: stackrox
      roleRef:
        apiGroup: rbac.authorization.k8s.io
        kind: Role
        name: use-scanner-scc
      subjects:
      - kind: ServiceAccount
        name: scanner
        namespace: stackrox
      - - -

      where:

      kind: Role
      Specifies the type of Kubernetes resource, in this example, Role.
      metadata.name: <rolename>
      Specifies the name of the role resource.
      metadata.namespace
      Specifies the namespace in which the role is created.
      Rules
      Specifies the permissions granted by the role resource.
      kind: RoleBinding
      Specifies the type of Kubernetes resource, in this example, RoleBinding.
      metadata.name: <rolebindingname>
      Specifies the name of the role binding resource.
      metadata.roleRef
      Specifies the role to bind in the same namespace.
      metadata.subjects
      Specifies the subjects that are bound to the role.
    2. Create the role and role binding resources specified in the update-central.yaml file by running the following command:

      $ oc -n stackrox create -f ./update-central.yaml
  3. To add the required roles and role bindings to use the Red Hat OpenShift SCCs for all secured clusters, complete the following steps:

    1. Create a file named upgrade-scs.yaml that defines the role and role binding resources by using the following content:

      例 3.2. Example YAML file

      apiVersion: rbac.authorization.k8s.io/v1
      kind: Role  #
      metadata:
        annotations:
           email: support@stackrox.com
           owner: stackrox
        labels:
           app.kubernetes.io/component: collector
           app.kubernetes.io/instance: stackrox-secured-cluster-services
           app.kubernetes.io/name: stackrox
           app.kubernetes.io/part-of: stackrox-secured-cluster-services
           app.kubernetes.io/version: 4.4.0
           auto-upgrade.stackrox.io/component: sensor
        name: use-privileged-scc  #
        namespace: stackrox #
      rules:  #
      - apiGroups:
        - security.openshift.io
        resourceNames:
        - privileged
        resources:
        - securitycontextconstraints
        verbs:
        - use
      - - -
      apiVersion: rbac.authorization.k8s.io/v1
      kind: RoleBinding #
      metadata:
        annotations:
           email: support@stackrox.com
           owner: stackrox
        labels:
           app.kubernetes.io/component: collector
           app.kubernetes.io/instance: stackrox-secured-cluster-services
           app.kubernetes.io/name: stackrox
           app.kubernetes.io/part-of: stackrox-secured-cluster-services
           app.kubernetes.io/version: 4.4.0
           auto-upgrade.stackrox.io/component: sensor
        name: collector-use-scc #
        namespace: stackrox
      roleRef: #
        apiGroup: rbac.authorization.k8s.io
        kind: Role
        name: use-privileged-scc
      subjects: #
      - kind: ServiceAccount
        name: collector
        namespace: stackrox
      - - -

      where:

      kind: Role
      Specifies the type of Kubernetes resource, in this example, Role.
      metadata.name: <rolename>
      Specifies the name of the role resource.
      metadata.namespace
      Specifies the namespace in which the role is created.
      Rules
      Specifies the permissions granted by the role resource.
      kind: RoleBinding
      Specifies the type of Kubernetes resource, in this example, RoleBinding.
      metadata.name: <rolebindingname>
      Specifies the name of the role binding resource.
      metadata.roleRef
      Specifies the role to bind in the same namespace.
      metadata.subjects
      Specifies the subjects that are bound to the role.
    2. Create the role and role binding resources specified in the upgrade-scs.yaml file by running the following command:

      $ oc -n stackrox create -f ./update-scs.yaml
      重要

      You must run this command on each secured cluster to create the role and role bindings specified in the upgrade-scs.yaml file.

  4. Delete the SCCs that are specific to RHACS:

    1. To delete the SCCs that are specific to the Central cluster, run the following command:

      $ oc delete scc/stackrox-central scc/stackrox-central-db scc/stackrox-scanner
    2. To delete the SCCs that are specific to all secured clusters, run the following command:

      $ oc delete scc/stackrox-admission-control scc/stackrox-collector scc/stackrox-sensor
      重要

      You must run this command on each secured cluster to delete the SCCs that are specific to each secured cluster.

Verification

  • Ensure that all the pods are using the correct SCCs by running the following command:

    $ oc -n stackrox describe pods | grep 'openshift.io/scc\|^Name:'

    Compare the output with the following table:

    Expand
    ComponentPrevious custom SCCNew Red Hat OpenShift 4 SCC

    Central

    stackrox-central

    nonroot-v2

    Central-db

    stackrox-central-db

    nonroot-v2

    Scanner

    stackrox-scanner

    nonroot-v2

    Scanner-db

    stackrox-scanner

    nonroot-v2

    Admission Controller

    stackrox-admission-control

    restricted-v2

    Collector

    stackrox-collector

    privileged

    Sensor

    stackrox-sensor

    restricted-v2

3.4.3.1. Verifying secured cluster upgrade

After you have upgraded secured clusters, verify that the updated pods are working.

注意

If you use Kubernetes, enter kubectl instead of oc.

Procedure

  • Check that the new pods have deployed:

    $ oc get deploy,ds -n stackrox -o wide
    $ oc get pod -n stackrox --watch
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部