Creating an Agent DaemonSet workload

After you create a ConfigMap, deploy the database audit agent and configure database information in the agent DaemonSet. Your database can then be connected to the database audit instance.

Creating an Agent DaemonSet

  1. In the navigation pane, choose Workloads > DaemonSets and click Create DaemonSet.

    Figure 1 Creating a DaemonSet workload

  2. Configure basic information about the workload, as shown in Figure 2. Table 1 describes the parameters.

    Figure 2 Basic workload information
    Table 1 Workload parameters

    Parameter

    Description

    Example Value

    Workload Name

    Name of a workload, which must be unique

    agent-docker

    Cluster Name

    Cluster connected to the database to be audited

    scc-cmv-bj4

    Namespace

    Namespace of the cluster connected to the database to be audited

    default

  3. Click Next: Add Container. Click Add Container. In the dialog box that is displayed, click the Open Source Images tab and select centos.

    Figure 3 Selecting a CentOS image

  4. Set CentOS image parameters.

    1. Click the Basic Information tab. Select the image centos7.5.1804 and retain the default values for other parameters.

      If the centos7.5.1804 image is not supported in your region, perform the operations in Changing an Image.

    2. Click the Lifecycle tab and set the commands used when the container is started or running. Set the following parameters and retain the default values for other parameters:
      • Start Command: command executed when a container is started
        • Command: top
        • Args: -b
      • Post-Start: command executed while a container is up and running
        • Args: CLI
        • Command:

          /bin/bash

          -c

          tar xvf /tmp/dbss/agent/dbss_agent.tar.gz -C /opt;/opt/dbss_agent/install.sh;rm -rf /opt/dbss_agent
          Figure 4 Command parameters for container startup and running
    3. Click the Data Storage tab and mount extra volumes to the container.
      1. Click the Local Volume tab and click Add Local Volume. In the dialog box that is displayed, set the following parameters and retain the default values for other parameters:
        • Set Type to ConfigMap
        • Set ConfigMap to the one created in Creating a ConfigMap.
        • Set Container Path for the ConfigMap (for example, /tmp/dbss/db).
          Figure 5 Add Local Volume dialog box
      2. Click OK.
      3. Click the Cloud Volume tab and click Add Cloud Volume. In the dialog box that is displayed, set the following parameters and retain the default values for other parameters:
        • Set Type to OBS.
        • Set Allocation Mode to Manual.
        • Set Name to the PVC of the OBS bucket created in Importing Configurations to OBS.
        • Set Container Path for the storage (for example, /tmp/dbss/agent).
          Figure 6 Add Cloud Volume dialog box
      4. Click OK.

        If your database configurations changed, you need to add a new cloud volume and remove the old one.

        To add a cloud volume, click a workload and click the Upgrade tab. Click Advanced Settings, click the Data Storage tab, and click Cloud Volume. Click Add Cloud Volume.

  5. Keep the access settings and advanced settings as they are. Click Next: Set Application Access, Next: Configure Advanced Settings, and Create.
  6. Return to the DaemonSets page. In the Operation column of the new DaemonSet, choose More > Edit YAML.
  7. In the Edit YAML dialog box, add hostNetwork: true under the spec.template.spec field.

    Figure 7 Editing a YAML file

  8. Click Edit.
  9. Check the DaemonSet workload status.

    If the workload is in the Running state, it has been successfully created.
    Figure 8 DaemonSet workload created

  10. Go to the DBSS console. Check the agent status.

    Expand the agent list of a database and locate the required agent. If its value of General is Yes and Status is Running, as shown in Figure 9, the database to be audited is successfully connected to the database audit instance.
    Figure 9 Database audit connected

Changing an Image

If the centos7.5.1804 image is not supported in your region, perform the following steps to change to this image:

  1. Configure the image name.

    1. Open a new browser window. Log in to the SoftWare Repository for Container (SWR) console.
    2. In the navigation pane, choose Image Resources > Image Center.
    3. Click Image Accelerator. In the displayed Image Accelerator dialog box, copy the accelerator address. Add /library/centos:centos7.5.1804 to the end of the address.

      Example: 7b01ab6xxxxfb06b2.mirror.swr.myhuaweicloud.com/library/centos:centos7.5.1804

      Figure 10 Accelerator address

  2. Change the image.

    1. Go back to the page for Setting CentOS image parameters.
    2. Click Change Image. In the Select Container Image dialog box, click the Third-Party Images tab.
      Figure 11 Replacing an image
    3. Enter the image address, as shown in Figure 12.
      Figure 12 Changing an image
    4. Click OK.