blob: 223e3d8b750a9aa374b39f5097656270ac4eb0bd [file] [log] [blame]
Zack Williams794532a2021-03-18 17:38:36 -07001..
2 SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
3 SPDX-License-Identifier: Apache-2.0
4
5VPN Bootstrap
6=============
7
8This section walks you through how to set up a VPN between ACE and Aether
9Central in GCP. We will be using GitOps based Aether CD pipeline for this, so
10we just need to create a patch to **aether-pod-configs** repository. Note that
11some of the steps described here are not directly related to setting up a VPN,
12but rather are a prerequisite for adding a new ACE.
13
14.. attention::
15
16 If you are adding another ACE to an existing VPN connection, go to
17 :ref:`Add ACE to an existing VPN connection <add_ace_to_vpn>`
18
19Before you begin
20----------------
21
22* Make sure firewall in front of ACE allows UDP port 500, UDP port 4500, and
23 ESP packets from **gcpvpn1.infra.aetherproject.net(35.242.47.15)** and
24 **gcpvpn2.infra.aetherproject.net(34.104.68.78)**
25
26* Make sure that the external IP on ACE side is owned by or routed to the
27 management node
28
29To help your understanding, the following sample ACE environment will be used
30in the rest of this section. Make sure to replace the sample values when you
31actually create a review request.
32
33+-----------------------------+----------------------------------+
34| Management node external IP | 128.105.144.189 |
35+-----------------------------+----------------------------------+
36| ASN | 65003 |
37+-----------------------------+----------------------------------+
38| GCP BGP IP address | Tunnel 1: 169.254.0.9/30 |
39| +----------------------------------+
40| | Tunnel 2: 169.254.1.9/30 |
41+-----------------------------+----------------------------------+
42| ACE BGP IP address | Tunnel 1: 169.254.0.10/30 |
43| +----------------------------------+
44| | Tunnel 2: 169.254.1.10/30 |
45+-----------------------------+----------------------------------+
46| PSK | UMAoZA7blv6gd3IaArDqgK2s0sDB8mlI |
47+-----------------------------+----------------------------------+
48| Management Subnet | 10.91.0.0/24 |
49+-----------------------------+----------------------------------+
50| K8S Subnet | Pod IP: 10.66.0.0/17 |
51| +----------------------------------+
52| | Cluster IP: 10.66.128.0/17 |
53+-----------------------------+----------------------------------+
54
55Download aether-pod-configs repository
56--------------------------------------
57
58.. code-block:: shell
59
60 $ cd $WORKDIR
61 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-pod-configs"
62
63.. _update_global_resource:
64
65Update global resource maps
66---------------------------
67
68Add a new ACE information at the end of the following global resource maps.
69
70* ``user_map.tfvars``
71* ``cluster_map.tfvars``
72* ``vpn_map.tfvars``
73
74As a note, you can find several other global resource maps under the
75``production`` directory. Resource definitions that need to be shared among
76clusters or are better managed in a single file to avoid configuration
77conflicts are maintained in this way.
78
79.. code-block:: diff
80
81 $ cd $WORKDIR/aether-pod-configs/production
82 $ vi user_map.tfvars
83
84 # Add the new cluster admin user at the end of the map
85 $ git diff user_map.tfvars
86 --- a/production/user_map.tfvars
87 +++ b/production/user_map.tfvars
88 @@ user_map = {
89 username = "menlo"
90 password = "changeme"
91 global_roles = ["user-base", "catalogs-use"]
92 + },
93 + test_admin = {
94 + username = "test"
95 + password = "changeme"
96 + global_roles = ["user-base", "catalogs-use"]
97 }
98 }
99
100.. code-block:: diff
101
102 $ cd $WORKDIR/aether-pod-configs/production
103 $ vi cluster_map.tfvars
104
105 # Add the new K8S cluster information at the end of the map
106 $ git diff cluster_map.tfvars
107 --- a/production/cluster_map.tfvars
108 +++ b/production/cluster_map.tfvars
109 @@ cluster_map = {
110 kube_dns_cluster_ip = "10.53.128.10"
111 cluster_domain = "prd.menlo.aetherproject.net"
112 calico_ip_detect_method = "can-reach=www.google.com"
113 + },
114 + ace-test = {
115 + cluster_name = "ace-test"
116 + management_subnets = ["10.91.0.0/24"]
117 + k8s_version = "v1.18.8-rancher1-1"
118 + k8s_pod_range = "10.66.0.0/17"
119 + k8s_cluster_ip_range = "10.66.128.0/17"
120 + kube_dns_cluster_ip = "10.66.128.10"
121 + cluster_domain = "prd.test.aetherproject.net"
122 + calico_ip_detect_method = "can-reach=www.google.com"
123 }
124 }
125 }
126
127.. code-block:: diff
128
129 $ cd $WORKDIR/aether-pod-configs/production
130 $ vi vpn_map.tfvars
131
132 # Add VPN and tunnel information at the end of the map
133 $ git diff vpn_map.tfvars
134 --- a/production/vpn_map.tfvars
135 +++ b/production/vpn_map.tfvars
136 @@ vpn_map = {
137 bgp_peer_ip_address_1 = "169.254.0.6"
138 bgp_peer_ip_range_2 = "169.254.1.5/30"
139 bgp_peer_ip_address_2 = "169.254.1.6"
140 + },
141 + ace-test = {
142 + peer_name = "production-ace-test"
143 + peer_vpn_gateway_address = "128.105.144.189"
144 + tunnel_shared_secret = "UMAoZA7blv6gd3IaArDqgK2s0sDB8mlI"
145 + bgp_peer_asn = "65003"
146 + bgp_peer_ip_range_1 = "169.254.0.9/30"
147 + bgp_peer_ip_address_1 = "169.254.0.10"
148 + bgp_peer_ip_range_2 = "169.254.1.9/30"
149 + bgp_peer_ip_address_2 = "169.254.1.10"
150 }
151 }
152
153.. note::
154 Unless you have a specific requirement, set ASN and BGP addresses to the next available values in the map.
155
156
157Create ACE specific configurations
158----------------------------------
159
160In this step, we will create a directory under `production` with the same name
161as ACE, and add several Terraform configurations and Ansible inventory needed
162to configure a VPN connection.
163
164Throughout the deployment procedure, this directory will contain all ACE
165specific configurations.
166
167Run the following commands to auto-generate necessary files under the target
168ACE directory.
169
170.. code-block:: shell
171
172 $ cd $WORKDIR/aether-pod-configs/tools
173 $ cp ace_env /tmp/ace_env
174 $ vi /tmp/ace_env
175 # Set environment variables
176
177 $ source /tmp/ace_env
178 $ make vpn
179 Created ../production/ace-test
180 Created ../production/ace-test/main.tf
181 Created ../production/ace-test/variables.tf
182 Created ../production/ace-test/gcp_fw.tf
183 Created ../production/ace-test/gcp_ha_vpn.tf
184 Created ../production/ace-test/ansible
185 Created ../production/ace-test/backend.tf
186 Created ../production/ace-test/cluster_val.tfvars
187 Created ../production/ace-test/ansible/hosts.ini
188 Created ../production/ace-test/ansible/extra_vars.yml
189
190.. attention::
191 The predefined templates are tailored to Pronto BOM. You'll need to fix `cluster_val.tfvars` and `ansible/extra_vars.yml`
192 when using a different BOM.
193
194Create a review request
195-----------------------
196
197.. code-block:: shell
198
199 $ cd $WORKDIR/aether-pod-configs/production
200 $ git status
201 On branch tools
202 Changes not staged for commit:
203
204 modified: cluster_map.tfvars
205 modified: user_map.tfvars
206 modified: vpn_map.tfvars
207
208 Untracked files:
209 (use "git add <file>..." to include in what will be committed)
210
211 ace-test/
212
213 $ git add .
214 $ git commit -m "Add test ACE"
215 $ git review
216
217Once the review request is accepted and merged,
218CD pipeline will create VPN tunnels on both GCP and the management node.
219
220Verify VPN connection
221---------------------
222
223You can verify the VPN connections after successful post-merge job by checking
224the routing table on the management node and trying to ping to one of the
225central cluster VMs.
226
227Make sure two tunnel interfaces, `gcp_tunnel1` and `gcp_tunnel2`, exist
228and three additional routing entries via one of the tunnel interfaces.
229
230.. code-block:: shell
231
232 # Verify routings
233 $ netstat -rn
234 Kernel IP routing table
235 Destination Gateway Genmask Flags MSS Window irtt Iface
236 0.0.0.0 128.105.144.1 0.0.0.0 UG 0 0 0 eno1
237 10.45.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1
238 10.52.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1
239 10.66.128.0 10.91.0.8 255.255.128.0 UG 0 0 0 eno1
240 10.91.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eno1
241 10.168.0.0 169.254.0.9 255.255.240.0 UG 0 0 0 gcp_tunnel1
242 128.105.144.0 0.0.0.0 255.255.252.0 U 0 0 0 eno1
243 169.254.0.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel1
244 169.254.1.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel2
245
246 # Verify ACC VM access
247 $ ping 10.168.0.6
248
249 # Verify ACC K8S cluster access
250 $ nslookup kube-dns.kube-system.svc.prd.acc.gcp.aetherproject.net 10.52.128.10
251
252You can further verify whether the ACE routes are propagated well to GCP
253by checking GCP dashboard **VPC Network > Routes > Dynamic**.
254
255
256Post VPN setup
257--------------
258
259Once you verify the VPN connections, please update `ansible` directory name to
260`_ansible` to prevent the ansible playbook from running again. Note that it is
261no harm to re-run the ansible playbook but not recommended.
262
263.. code-block:: shell
264
265 $ cd $WORKDIR/aether-pod-configs/production/$ACE_NAME
266 $ mv ansible _ansible
267 $ git add .
268 $ git commit -m "Mark ansible done for test ACE"
269 $ git review
270
271.. _add_ace_to_vpn:
272
273Add another ACE to an existing VPN connection
274"""""""""""""""""""""""""""""""""""""""""""""
275
276VPN connections can be shared when there are multiple ACE clusters in a site.
277In order to add ACE to an existing VPN connection, you'll have to SSH into the
278management node and manually update BIRD configuration.
279
280.. note::
281
282 This step needs improvements in the future.
283
284.. code-block:: shell
285
286 $ sudo vi /etc/bird/bird.conf
287 protocol static {
288 ...
289 route 10.66.128.0/17 via 10.91.0.10;
290
291 # Add routings for the new ACE's K8S cluster IP range via cluster nodes
292 # TODO: Configure iBGP peering with Calico nodes and dynamically learn these routings
293 route <NEW-ACE-CLUSTER-IP> via <SERVER1>
294 route <NEW-ACE-CLUSTER-IP> via <SERVER2>
295 route <NEW-ACE-CLUSTER-IP> via <SERVER3>
296 }
297
298 filter gcp_tunnel_out {
299 # Add the new ACE's K8S cluster IP range and the management subnet if required to the list
300 if (net ~ [ 10.91.0.0/24, 10.66.128.0/17, <NEW-ACE-CLUSTER-IP-RANGE> ]) then accept;
301 else reject;
302 }
303 # Save and exit
304
305 $ sudo birdc configure
306
307 # Confirm the static routes are added
308 $ sudo birdc show route
309