docs: add contiv vpp
[vpp.git] / docs / usecases / contiv / SINGLE_NIC_SETUP.md
1 ### Setting up a Node with a Single NIC
2
3 #### Installing the STN Daemon
4 The STN (Steal the NIC) daemon must be installed on every node in the cluster that has only 
5 one NIC. The STN daemon installation(*) should be performed before deployment 
6 of the Contiv-VPP plugin.
7
8 \* Docker daemon must be present when installing STN.  Also, Docker must be configured to allow shared mount.
9 On CentOS, this may not be the case by default.  You can enable it by following the instructions at
10 [https://docs.portworx.com/knowledgebase/shared-mount-propagation.html](https://docs.portworx.com/knowledgebase/shared-mount-propagation.html).
11
12
13 Run as root (not using sudo):
14 ```
15 bash <(curl -s https://raw.githubusercontent.com/contiv/vpp/master/k8s/stn-install.sh)
16 ```
17 The install script should output the following:
18 ```
19 Installing Contiv STN daemon.
20 Starting contiv-stn Docker container:
21 550334308f85f05b2690f5cfb5dd945bd9c501ab9d074231f15c14d7098ef212
22 ```
23
24 Check that the STN daemon is running:
25 ```
26 docker ps -a 
27 CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
28 550334308f85        contivvpp/stn       "/stn"              33 seconds ago      Up 33 seconds                           contiv-stn
29 ```
30
31 Check that the STN daemon is operational:
32 ```
33 docker logs contiv-stn
34 ```
35 The expected logs would look like the following excerpt:
36 ```
37 2018/02/23 10:08:34 Starting the STN GRPC server at port 50051
38 ```
39
40 For more details, please read the Go documentation for [contiv-stn](https://github.com/contiv/vpp/blob/master/cmd/contiv-stn/doc.go)
41 and [contiv-init](https://github.com/contiv/vpp/blob/master/cmd/contiv-init/doc.go).
42
43 #### Creating a VPP Interface Configuration
44 Create the VPP configuration for the hardware interface as described 
45 [here](https://github.com/contiv/vpp/blob/master/docs/VPP_CONFIG.md#single-nic-configuration).
46
47 #### Configuring STN in Contiv-VPP K8s Deployment Files
48 The STN feature is disabled by default. It needs to be enabled either globally,
49 or individually for every node in the cluster. 
50
51 ##### Global Configuration:
52 Global configuration is used in homogeneous environments where all nodes in 
53 a given cluster have the same hardware configuration, for example only a single
54 Network Adapter. To enable the STN feature globally, put the `StealFirstNIC: True`
55 stanza into the [`contiv-vpp.yaml`][1] deployment file, for example:
56 ```
57 data:
58   contiv.yaml: |-
59     TCPstackDisabled: true
60     ...
61     StealFirstNIC: True
62     ...
63     IPAMConfig:
64 ```
65
66 Setting `StealFirstNIC` to `True` will tell the STN Daemon on every node in the 
67 cluster to steal the first NIC from the kernel and assign it to VPP. Note that
68 the Network Adapters on different nodes do not need to be of the same type. You
69 still need to create the respective vswitch configurations on every node in the
70 cluster, as shown [above](#creating-a-vpp-interface-configuration).
71
72 ##### Individual Configuration:
73 Individual configuration is used in heterogeneous environments where each node
74 in a given cluster may be configured differently. To enable the STN feature 
75 for a specific node in the cluster, put the following stanza into its Node
76 Configuration in the [`contiv-vpp.yaml`][1] deployment file, for example:
77 ```
78 ...
79     NodeConfig:
80     - NodeName: "ubuntu-1"
81       StealInterface: "enp0s8"
82     - NodeName: "ubuntu-2"
83       StealInterface: "enp0s8"
84 ...
85 ``` 
86 Note that you still have to create the vswitch configuration on the node as
87 shown [here](#creating-a-vpp-interface-configuration).
88
89
90
91 #### Uninstalling the STN Daemon
92
93 Run as root (not using sudo):
94 ```
95 bash <(curl -s https://raw.githubusercontent.com/contiv/vpp/master/k8s/stn-install.sh) --uninstall
96 ```
97 The install script should output the following:
98 ```
99 Uninstalling Contiv STN daemon.
100 Stopping contiv-stn Docker container:
101 contiv-stn
102 contiv-stn
103 contiv-stn
104 ```
105 Make sure that the STN daemon has been uninstalled:
106 ```
107 docker ps -q -f name=contiv-stn
108 ```
109 No containers should be listed.
110
111 [1]: ../k8s/contiv-vpp.yaml