Long-Term Supported Versions

    Innovation Versions

      Installation and Deployment

      Overview

      This chapter describes how to install and deploy the Rubik component.

      Software and Hardware Requirements

      Hardware

      • Architecture: x86 or AArch64
      • Drive: 1 GB or more
      • Memory: 100 MB or more

      Software

      • OS: openEuler 22.03-LTS-SP3
      • Kernel: openEuler 22.03-LTS-SP3 kernel

      Environment Preparation

      Installing Rubik

      Rubik is deployed on each Kubernetes node as a DaemonSet. Therefore, you need to perform the following steps to install the Rubik RPM package on each node.

      1. Configure the Yum repositories openEuler 22.03-LTS-SP3 and openEuler 22.03-LTS-SP3:EPOL (the Rubik component is available only in the EPOL repository).

        # openEuler 22.03-LTS-SP3 official repository
        name=openEuler22.03-LTS-SP3-Epol
        baseurl=https://repo.openeuler.org/openEuler-22.03-LTS-SP3/EPOL/$basearch/
        enabled=1
        gpgcheck=1
        gpgkey=https://repo.openeuler.org/openEuler-22.03-LTS-SP3/everything/$basearch/RPM-GPG-KEY-openEuler
        
        # openEuler 22.03-LTS-SP3:EPOL official repository
        name=Epol
        baseurl=https://repo.openeuler.org/openEuler-22.03-LTS-SP3/EPOL/$basearch/
        enabled=1
        gpgcheck=0
        
      2. Install Rubik with root permissions.

        sudo yum install -y rubik
        

      Note:

      Files related to Rubik are installed in the /var/lib/rubik directory.

      Deploying Rubik

      Rubik runs as a container in a Kubernetes cluster in hybrid deployment scenarios. It is used to isolate and restrict resources for services with different priorities to prevent offline services from interfering with online services, improving the overall resource utilization and ensuring the quality of online services. Currently, Rubik supports isolation and restriction of CPU and memory resources, and must be used together with the openEuler 22.03-LTS-SP3 kernel. To enable or disable the memory priority feature (that is, memory tiering for services with different priorities), you need to set the value in the /proc/sys/vm/memcg_qos_enable file. The value can be 0 or 1. The default value 0 indicates that the feature is disabled, and the value 1 indicates that the feature is enabled.

      sudo echo 1 > /proc/sys/vm/memcg_qos_enable
      

      Deploying Rubik DaemonSet

      1. Run the /var/lib/rubik/build_rubik_image.sh script to automatically build a Rubik image. Because the script uses the docker build command, make sure Docker is available. You can also use the Docker engine to build the Rubik image. Because Rubik is deployed as a DaemonSet, each node requires a Rubik image. After building an image on a node, use the docker save and docker load commands to load the Rubik image to each node of Kubernetes. Alternatively, build a Rubik image on each node. The following uses docker as an example. The command is as follows:

        docker build -f /var/lib/rubik/Dockerfile -t rubik:2.0.0-1 .
        
      2. On the Kubernetes master node, change the Rubik image name in the /var/lib/rubik/rubik-daemonset.yaml file to the name of the image built in the previous step.

        ...
        containers:
        - name: rubik-agent
        image: rubik_image_name_and_tag  # The image name must be the same as the Rubik image name built in the previous step.
        imagePullPolicy: IfNotPresent
        ...
        
      3. On the Kubernetes master node, run the kubectl command to deploy the Rubik DaemonSet so that Rubik will be automatically deployed on all Kubernetes nodes.

        kubectl apply -f /var/lib/rubik/rubik-daemonset.yaml
        
      4. Run the kubectl get pods -A command to check whether Rubik has been deployed on each node in the cluster. (The number of rubik-agents is the same as the number of nodes and all rubik-agents are in the Running status.)

        $ kubectl get pods -A | grep rubik
        NAMESPACE     NAME                                            READY   STATUS    RESTARTS   AGE
        ...
        kube-system   rubik-agent-76ft6                               1/1     Running   0          4s
        ...
        

      Common Configuration Description

      The Rubik deployed using the preceding method is started with the default configurations. You can modify the Rubik configurations as required by modifying the config.json section in the rubik-daemonset.yaml file and then redeploy the Rubik DaemonSet. The following describes some common configurations. For other configurations, see Rubik Configuration Description.

      Absolute Pod Preemption

      If absolute pod preemption is enabled, you only need to specify the priority using annotations in the YAML file when deploying the service pods. After being deployed successfully, Rubik automatically detects the creation and update of the pods on the current node, and sets the pod priorities based on the configured priorities. For pods that are already started or whose annotations are modified, Rubik automatically updates the pod priority configurations.

      ...
        "agent": {
          "enabledFeatures": [
            "preemption"
          ]
        },
        "preemption": {
          "resource": [
            "cpu",
            "memory"
          ]
        }
      ...
      

      Priority configurations support only pods switching from online to offline.

      Configuring Rubik for Online and Offline Services

      After Rubik is successfully deployed, you can modify the YAML file of a service to specify the service type based on the following configuration example. Then Rubik can configure the priority of the service after it is deployed to isolate resources.

      The following is an example of deploying an online Nginx service:

      apiVersion: v1
      kind: Pod
      metadata:
        name: nginx
        namespace: qosexample
        annotations:
          volcano.sh/preemptable: "false"   # If volcano.sh/preemptable is set to true, the service is an offline service. If it is set to false, the service is an online service. The default value is false.
      spec:
        containers:
        - name: nginx
          image: nginx
          resources:
            limits:
              memory: "200Mi"
              cpu: "1"
            requests:
              memory: "200Mi"
              cpu: "1"
      

      Bug Catching

      Buggy Content

      Bug Description

      Submit As Issue

      It's a little complicated....

      I'd like to ask someone.

      PR

      Just a small problem.

      I can fix it online!

      Bug Type
      Specifications and Common Mistakes

      ● Misspellings or punctuation mistakes;

      ● Incorrect links, empty cells, or wrong formats;

      ● Chinese characters in English context;

      ● Minor inconsistencies between the UI and descriptions;

      ● Low writing fluency that does not affect understanding;

      ● Incorrect version numbers, including software package names and version numbers on the UI.

      Usability

      ● Incorrect or missing key steps;

      ● Missing prerequisites or precautions;

      ● Ambiguous figures, tables, or texts;

      ● Unclear logic, such as missing classifications, items, and steps.

      Correctness

      ● Technical principles, function descriptions, or specifications inconsistent with those of the software;

      ● Incorrect schematic or architecture diagrams;

      ● Incorrect commands or command parameters;

      ● Incorrect code;

      ● Commands inconsistent with the functions;

      ● Wrong screenshots.

      Risk Warnings

      ● Lack of risk warnings for operations that may damage the system or important data.

      Content Compliance

      ● Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions;

      ● Copyright infringement.

      How satisfied are you with this document

      Not satisfied at all
      Very satisfied
      Submit
      Click to create an issue. An issue template will be automatically generated based on your feedback.
      Bug Catching
      编组 3备份