Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Allocate CPUs to the JCNR Forwarding Plane

SUMMARY Learn how to allocate CPU cores using static CPU allocation or using the Kubernetes CPU Manager.

The JCNR installation Helm chart and the vRouter CRD provide you with a number of controls to allocate CPU cores to the JCNR vRouter. You can specify the requested number of cores, the core limit, and the cores to be assigned, either through static CPU allocation or through the Kubernetes CPU Manager.

Allocate CPUs Using the Kubernetes CPU Manager

Use this procedure to allocate CPU cores to vRouter DPDK pods using the Kubernetes CPU Manager.

This is the recommended approach if your cluster is running the Kubernetes CPU Manager.

  1. Specify the resource limits and requests for the contrail-vrouter-kernel-init-dpdk and the contrail_vrouter_agent_dpdk containers.
    1. Locate the helmchart/jcnr/charts/jcnr-vrouter/values.yaml file in your installation directory.
    2. Edit that file to specify the resource limits and requests for both the contrail-vrouter-kernel-init-dpdk and the contrail_vrouter_agent_dpdk containers.
      To guarantee that each container gets what it's asking for, set the same cpu value in both the limits and requests sections, and set the same memory value in both the limits and requests sections for each container.
  2. Configure the Helm chart to specify the number of guaranteed vRouter CPUs that you want for the vRouter pods.
    In the main values.yaml file:
    1. Disable the static CPU allocation method of assigning CPU cores by commenting out the following lines:
    2. Configure the vRouter DPDK pods to use the guaranteed CPUs reserved by the Kubernetes CPU Manager.
      For example, to reserve 5 CPU cores:This value must be:
      • greater or equal to the number of CPU cores configured for the contrail-vrouter-kernel-init-dpdk and the contrail_vrouter_agent_dpdk containers in helmchart/charts/jcnr/jcnr-vrouter/values.yaml, and

      • smaller or equal to the number of CPU cores reserved by the Kubernetes CPU Manager.

      The minimum recommended number is one more than the desired number of forwarding cores.
    3. Specify the number of CPU cores to use for vRouter DPDK service/control threads.
      For example, to reserve 1 core for vRouter DPDK service/control threads:This leaves the remaining cores (four, in this example) for forwarding.
  3. Proceed with your JCNR installation.
  4. After JCNR is installed, check to make sure the vRouter DPDK pods has a QoS Class of Guaranteed.
    The output should look like this:
  5. To find out which CPUs are allocated to the vRouter DPDK container:
    The output should list the cores assigned to the container.
  6. To view the CPU assignment from the Kubernetes CPU Manager:
    1. SSH into a node where JCNR is running.
    2. Look at the Kubernetes CPU Manager state.
      For example:
      Note:

      You'll need to install jq (dnf install -y jq) in order to see formatted output.

Allocate CPUs Using Static CPU Allocation

Use this procedure to allocate CPU cores to vRouter DPDK pods using static CPU allocation.

We recommend you use this method only when your cluster is not running the Kubernetes CPU Manager.

  1. Specify the resource limits and requests for the contrail-vrouter-kernel-init-dpdk and the contrail_vrouter_agent_dpdk containers.
    1. Locate the helmchart/jcnr/charts/jcnr-vrouter/values.yaml file in your installation directory.
    2. Edit that file to specify the resource limits and requests for both the contrail-vrouter-kernel-init-dpdk and the contrail_vrouter_agent_dpdk containers.
      To guarantee that each container gets what it's asking for, set the same cpu value in both the limits and requests sections, and set the same memory value in both the limits and requests sections for each container.
  2. Configure the Helm chart to specify the cores that you want the vRouter DPDK to use.
    1. Disable the use of the Kubernetes CPU Manager for vRouter core allocation by commenting out the following:
    2. Specify the CPU cores to use for static CPU allocation.
      For example, to specify cores 2, 3, 22, and 23:
    3. Specify the CPU cores to use for vRouter DPDK service/control threads.
      For example, to reserve cores 2 and 3 for vRouter DPDK service/control threads:

      This example leaves cores 22 and 23 for forwarding.

  3. Proceed with your JCNR installation.