Access vRouter CLI
You can access the command-line interface (CLI) of the vRouter by accessing the shell of the running vRouter-agent container.
The commands below are provided as an example. The vRouter pod name must be replaced from your environment. The command outputs may differ based on your environment.
List the running pods on the K8s Cluster:
kubectl get pods -A NAMESPACE NAME READY STATUS RESTARTS AGE contrail-deploy contrail-k8s-deployer-5dff6d8b89-7pt9c 1/1 Running 0 138m contrail contrail-tools-p27js 1/1 Running 0 138m contrail jcnr-0-dp-contrail-vrouter-nodes-fslcb 2/2 Running 0 138m contrail jcnr-0-dp-contrail-vrouter-nodes-vrdpdk-pw9w6 1/1 Running 0 138m jcnr jcnr-0-crpd-0 2/2 Running 0 135m jcnr syslog-ng-svzxg 1/1 Running 0 138m kube-system calico-kube-controllers-7675746f76-bqbvc 1/1 Running 0 179d kube-system calico-node-pt7vb 1/1 Running 0 540d kube-system coredns-59d6b54d97-2qms8 1/1 Running 0 540d kube-system dns-autoscaler-7944dc7978-9t7zd 1/1 Running 0 540d kube-system kube-apiserver-5d8s1-node1 1/1 Running 0 483d kube-system kube-controller-manager-5d8s1-node1 1/1 Running 0 359d kube-system kube-multus-ds-amd64-hhhk9 1/1 Running 0 126d kube-system kube-proxy-nfvrl 1/1 Running 0 540d kube-system kube-scheduler-5d8s1-node1 1/1 Running 0 359d kube-system kube-sriov-cni-ds-amd64-wcsfh 1/1 Running 0 126d kube-system kube-sriov-device-plugin-amd64-b9qvp 1/1 Running 0 223d kube-system nodelocaldns-qzjq9 1/1 Running 0 540d
Copy the name of the vRouter pod—cjcnr-0-dp-contrail-vrouter-nodes-fslcb
in
this example output . You will use the pod name to connect to the running container's
shell.
Issue the kubectl exec
command to access the running container's shell:
kubectl exec -n <namespace> -it <pod name> --container <container name> -- bash
where <namespace> identifies the namespace in which the pod is running, <pod name> specificies the name of the pod and the <container name> specifies the name of the container (to be specified if the pod has more than one container).
The vRouter pod has three containers. When the container name is not specified, the command will default to the vrouter-agent container shell. Here is an example:
[root@jcnr-01]# kubectl exec -n contrail -it jcnr-0-dp-contrail-vrouter-nodes-fslcb -- bash Defaulted container "contrail-vrouter-agent" out of: contrail-vrouter-agent, contrail-vrouter-telemetry-exporter, contrail-init (init) [root@jcnr-01 /]#
At this point, you have connected to the vRouter's CLI.