Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

L2 - Add User Pod with Kernel Access to a Cloud-Native Router Instance

SUMMARY Read this topic to learn how to add a user pod with a kernel access interface to an instance of the cloud-native router.

Overview

To add a user pod to the cloud-native router, your high-level tasks are:

  • Ensure that a network attachment definition (NAD) exists.

  • Apply a pod YAML file to your cloud-native router cluster.

Throughout this example, we use the kubectl command with various options. You must run this command on the host-server CLI.

High-Level Steps

In this example, we assume that this is the first user pod that you are adding to your newly installed cloud-native router. Therefore, we provide the steps to create a NAD on the cluster and then add the new user pod.

Below we provide a list of the individual steps we perform in this example. Each step in the list is a link to the detailed description of the step.

  1. View the vRouter interface list

  2. Examine the example NAD YAML file

  3. Apply the NAD to the cluster

  4. Verify the NAD

  5. Examine the example Pod YAML file

  6. Apply the Pod to the cluster

  7. Verify the Pod

  8. View the updated vRouter interface list

Before You Begin

Access the vRouter-Agent CLI

You perform the first and last steps of this example procedure on the CLI of the vRouter agent. We recommend that you open two SSH (terminal) sessions to the host server. You can use one session to run the CLI commands on the vRouter agent and the other session to run the kubectl commands that deploy the NAD and the pod on the cluster.

Note:

To make it easy to copy and paste commands from here to your system, we do not include paths or shell prompts from the host server in the command listings.

Access the CLI of the contrail-vrouter-agent container in the contrail-vrouter-masters pod.

In one terminal, enter this command:

The output should be a single line that looks like this:

This output gives you the name and specific instance hash of the vRouter pod, contrail-vrouter-masters-97v8z. We use this name in the next command to access the vRouter CLI. The name of your vRouter pod will have a different hash at the end. Use the pod name from your system in place of <contrail-vrouter-masters-hash> in the following command.

Enter the following command:

You should see the following two-line output:

Note that the shell prompt has changed from what it was when you entered the command. On the system we used to create this example, the prompt changed from [root@jcnr1 ~]# to root@jcnr1:/#. This change in prompt indicates that you have successfully connected to the CLI of the vRouter agent.

You can now see the following detailed steps to complete the example.

Detailed Steps

  1. View the vRouter-agent interface list.

    In the terminal session connected to the vRouter-agent CLI, enter the following command:

    The output looks like this:

    As you can see, the vRouter agent knows about five interfaces

    • vif0/0

    • vif0/1

    • vif0/2

    • vif0/3

    • vif0/4

    Back to high-level steps

  2. Examine the NAD YAML file.

    In this step, we look at a commented NAD file in the YAML format. The comments start with a hash symbol (#) and are displayed in boldface. You do not need to change most of the values because this file contains a NAD example. The NAD specifies the parameters of a virtual device that enables the pod to connect to the network. You can use this example file on your cloud-native router only if you remove the comments from the file.

    cat nad-kernel_access_bd3001.yaml

    When you apply the NAD YAML file to the cluster, the virtual device becomes visible in the Kubernetes cluster.

    Back to high-level steps

  3. Apply the NAD to the cluster.

    If you use the same file name for your version of the NAD file, you can run the following command on the host-server CLI:

    The command output looks like this:

    networkattachmentdefinition.k8s.cni.cncf.io/nad-vswitch-bd3001 created

    Back to high-level steps

  4. Verify the NAD.

    On the host-server CLI, issue the following command:

    The output from the command looks like this:

    Back to high-level steps

  5. Examine the example Pod YAML file.

    Similar to the NAD YAML file, the pod YAML file or the pod definition specifies the configuration of the user pod that you want to create. In this example, we create a pod that works with the pod1-vswitch-bd3001 NAD that we just applied. You can use the following file on your cloud-native router deployment .

    cat pod-kernel-access-vlan-3001.yaml

    Back to high-level steps

  6. Apply the pod to the cluster.

    If you have used the preceding filename for the pod YAML file, then you can run the following command on the host-server CLI to apply the pod to the cluster:

    The command output looks like this:

    pod/odu-kernel-pod-bd3001 created created

    Back to high-level steps

  7. Verify the pod.

    On the host-server CLI, issue the following command to verify the pod creation:

    The command output looks like this:

    Back to high-level steps

  8. View the updated vRouter interface list.

    On the vRouter-agent CLI, issue the following command:

    The command output looks like this:

    The vRouter agent now knows about six interfaces. This is because the Pod created the sub-interface and the parent interface. You can see above that the virtual VLAN interface, vif0/4, shows the parent interface as vif0/3. The interface, vif0/3, is a virtual interface with a name that includes "net1" as defined in the NAD and pod YAML files.

    Back to high-level steps