Skip to main content

Custom SCC Deployment Steps

This page describes the recommended order for deploying SmartAgent on OpenShift with a custom SCC: download smartagent.yml from ONE → deploy the SCC → deploy SmartAgent. For background and the privileged SCC alternative, see OpenShift deployment.

Plain-text notes without screenshots, used for test records and review, are in OpenShift test verification notes.

Prerequisites
  • Cluster-admin or equivalent permission, with oc configured and access to the target OpenShift cluster.
  • Nodes can reach the SmartAgent download and upload addresses.
  • Bonree Operator full-stack mode is not supported on OpenShift yet. Deploy with the DaemonSet YAML.

Step 1: Download smartagent.yml from ONE​

  1. Log in to Bonree ONE and go to Configuration > Agent Installation > Kubernetes.
  2. Select the SmartAgent / SmartGate version and technology type, and fill in required items such as Cluster Name.
  3. Expand Advanced settings and set Deployment mode to Custom mode (required when you use a custom SCC; do not use Standard mode).

  1. Configure the namespace, install directory, install parameters, and other items as needed (consistent with OpenShift deployment).

  2. In the YAML preview or install guide on the right side of the page, download the YAML file and save it locally as smartagent.yml (you can use another file name; this page uses this name).

  3. Edit smartagent.yml before deployment: the YAML generated by ONE does not include the following startup arguments by default. Manually append them to the SmartAgent DaemonSet container args (place them after the other install arguments, and keep platform-generated items such as the connection and cluster name unchanged):

            - "--non-root-mode"
- "true"
- "--user"
- "core"
- "--group"
- "core"

  1. Install path (recommended on OpenShift): use /var/opt as the host directory. Run realpath /opt on a node to confirm the real path (the common result is /var/opt). Do not use a path that contains a symlink. If you change the directory, update hostPath.path of host-install-path, SMARTAGENT_INSTALL_PATH, and volumeMounts.mountPath in the YAML. See OpenShift deployment — Installation path recommendation.

  2. SELinux level (as needed): if step 2 sets level on seLinuxContext in scc.yml, set the same value on the Pod securityContext.seLinuxOptions.level in smartagent.yml (see "SELinux level" in step 2). You can omit it when the SCC does not set level.

tip

Finish this step and keep the edited smartagent.yml before you run cluster operations in steps 2 and 3. users in scc.yml must match the ServiceAccount in smartagent.yml (default system:serviceaccount:bonree-agent:bonree-smartagent-enhance).


Step 2: Edit and deploy scc.yml​

  1. Get the SCC template: scc.yml (or copy it from static/en/smartagent/openshift/scc.yml in the repository).

  2. Confirm that both of the following are MustRunAs (if the template says MustRunAsAny, change it to MustRunAs):

seLinuxContext:
type: MustRunAs
supplementalGroups:
type: MustRunAs

SELinux level

  • The default SCC template only constrains seLinuxContext.type (for example, MustRunAs). It does not require a fixed MCS/MLS level. You can set level to any value for the customer environment. Bonree does not require a specific value.
  • If the customer explicitly sets level in seLinuxContext in scc.yml (and possibly user, role, and similar fields), securityContext.seLinuxOptions on the Pod in smartagent.yml must match the SCC (at least the level must be the same). Otherwise the Pod may fail SCC validation or not match the SCC policy.

SCC example (when the customer sets a custom level):

seLinuxContext:
type: MustRunAs
level: s0:c34,c14 # Example value. Use the actual policy.

Set the same level in spec.template.spec.securityContext of the DaemonSet in smartagent.yml (or the container-level securityContext, matching the YAML structure), for example:

securityContext:
seLinuxOptions:
level: 's0:c34,c14'

Use oc describe scc bonree-smartagent-scc or oc get pod <pod> -o yaml to check that the SELinux fields on the Pod and the SCC match.

  1. If the namespace or ServiceAccount name in smartagent.yml differs from the default, update the users list in scc.yml, for example:
users:
- system:serviceaccount:<namespace>:<ServiceAccount name>
  1. The ServiceAccount must already exist before you apply the SCC. If it does not exist yet, apply only the Namespace, ServiceAccount, RBAC, and similar resources from smartagent.yml first (do not create the DaemonSet yet), or run:
# Example: create the namespace only (if it is not already applied from the YAML)
oc create namespace bonree-agent --dry-run=client -o yaml | oc apply -f -
# Then apply the SA/RBAC resources from smartagent.yml. Or apply the whole file; if the DaemonSet fails because of the SCC, finish the SCC before step 3.
  1. Deploy the SCC:
oc apply -f scc.yml
  1. Verify the SCC and the binding (as needed):
oc get scc bonree-smartagent-scc
oc describe scc bonree-smartagent-scc

If the binding is not declared in users, add it:

oc adm policy add-scc-to-user bonree-smartagent-scc -z bonree-smartagent-enhance -n bonree-agent

Step 3: Deploy SmartAgent​

After the SCC is in effect, apply the smartagent.yml prepared in step 1. You can deploy when node SELinux is Enforcing, Permissive, or Disabled. No mode is required. When troubleshooting, you can temporarily switch Enforcing or Permissive to Permissive. If SELinux is enabled and seLinuxOptions (such as level) is set on both the SCC and the Pod, keep them the same.

oc apply -f smartagent.yml

Check the running status​

oc get pods -n bonree-agent
oc get ds -n bonree-agent
oc describe pod -n bonree-agent -l app=bonree-smartagent # Use the label from the actual YAML

If the Pod is rejected because of the SCC or SELinux, check the events:

oc get events -n bonree-agent --sort-by='.lastTimestamp'

Uninstall (brief)​

oc delete -f smartagent.yml
# Or follow the uninstall steps in [Kubernetes deployment (DaemonSet)](/ingest/agent/smartagent/kubernetes/index), using oc

oc delete scc bonree-smartagent-scc # When the custom SCC is no longer needed