blob: 1d7317a9f9b39dcfce7f43ff9d6b83c07cb2b1ac [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
Hyunsun Moona703edf2021-07-29 15:55:15 -07008This section guides you through setting up a VPN connection between Aether Central in GCP and ACE.
9We will be using GitOps based Aether CI/CD system for this and all you need to do is to
10create a couple of patches to Aether GitOps repositories.
11Note that some of the steps described here are not directly related to setting up a VPN,
Zack Williams794532a2021-03-18 17:38:36 -070012but rather are a prerequisite for adding a new ACE.
13
Hyunsun Moona703edf2021-07-29 15:55:15 -070014Add deployment jobs
15-------------------
16First, you need to add Jenkins jobs to Aether CI/CD system that build and apply
17infrastructure change plans for the new edge. This is done by creating a patch to
18**aether-ci-management** repository.
Zack Williams794532a2021-03-18 17:38:36 -070019
Hyunsun Moona703edf2021-07-29 15:55:15 -070020Download **aether-ci-management** repository.
Zack Williams794532a2021-03-18 17:38:36 -070021
Hyunsun Moona703edf2021-07-29 15:55:15 -070022.. code-block:: shell
23
24 $ cd $WORKDIR
25 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-ci-management"
26
27Add the jobs for the new cluster at the end of the `cd-pipeline-terraform-ace` project job list.
28Make sure to add both pre-merge and post-merge jobs.
29Note that the cluster name specified here will be used in the rest of the deployment procedure.
30
31.. code-block:: diff
32
33 $ cd $WORKDIR/aether-ci-management
34 $ vi jjb/repos/cd-pipeline-terraform.yaml
35
36 # Add jobs for the new cluster
37 diff jjb/repos/cd-pipeline-terraform.yamll
38 --- a/jjb/repos/cd-pipeline-terraform.yaml
39 +++ b/jjb/repos/cd-pipeline-terraform.yaml
40 @@ -227,3 +227,9 @@
41 - 'cd-pipeline-terraform-postmerge-cluster':
42 pod: 'production'
43 cluster: 'ace-eks'
44 + - 'cd-pipeline-terraform-premerge-cluster':
45 + pod: 'production'
46 + cluster: 'ace-test'
47 + - 'cd-pipeline-terraform-postmerge-cluster':
48 + pod: 'production'
49 + cluster: 'ace-test'
50
51Commit your change and wait for the jobs you just added available in Aether Jenkins.
52
53.. code-block:: shell
54
55 $ git status
56 Changes not staged for commit:
57
58 modified: jjb/repos/cd-pipeline-terraform.yaml
59
60 $ git add .
61 $ git commit -m "Add test ACE deployment job"
62 $ git review
63
64Gather VPN information
65----------------------
Zack Williams794532a2021-03-18 17:38:36 -070066
67* Make sure firewall in front of ACE allows UDP port 500, UDP port 4500, and
68 ESP packets from **gcpvpn1.infra.aetherproject.net(35.242.47.15)** and
69 **gcpvpn2.infra.aetherproject.net(34.104.68.78)**
70
71* Make sure that the external IP on ACE side is owned by or routed to the
72 management node
73
74To help your understanding, the following sample ACE environment will be used
75in the rest of this section. Make sure to replace the sample values when you
76actually create a review request.
77
78+-----------------------------+----------------------------------+
Hyunsun Moona703edf2021-07-29 15:55:15 -070079| Management node external IP | 66.201.42.222 |
Zack Williams794532a2021-03-18 17:38:36 -070080+-----------------------------+----------------------------------+
81| ASN | 65003 |
82+-----------------------------+----------------------------------+
83| GCP BGP IP address | Tunnel 1: 169.254.0.9/30 |
84| +----------------------------------+
85| | Tunnel 2: 169.254.1.9/30 |
86+-----------------------------+----------------------------------+
87| ACE BGP IP address | Tunnel 1: 169.254.0.10/30 |
88| +----------------------------------+
89| | Tunnel 2: 169.254.1.10/30 |
90+-----------------------------+----------------------------------+
91| PSK | UMAoZA7blv6gd3IaArDqgK2s0sDB8mlI |
92+-----------------------------+----------------------------------+
Hyunsun Moona703edf2021-07-29 15:55:15 -070093| Management Subnet | 10.32.4.0/24 |
Zack Williams794532a2021-03-18 17:38:36 -070094+-----------------------------+----------------------------------+
Hyunsun Moona703edf2021-07-29 15:55:15 -070095| K8S Subnet | Pod IP: 10.33.0.0/17 |
Zack Williams794532a2021-03-18 17:38:36 -070096| +----------------------------------+
Hyunsun Moona703edf2021-07-29 15:55:15 -070097| | Cluster IP: 10.33.128.0/17 |
Zack Williams794532a2021-03-18 17:38:36 -070098+-----------------------------+----------------------------------+
99
Hyunsun Moona703edf2021-07-29 15:55:15 -0700100.. note::
101 Use `this site <https://cloud.google.com/network-connectivity/docs/vpn/how-to/generating-pre-shared-key/>`_ to generate a new strong pre-shared key.
Zack Williams794532a2021-03-18 17:38:36 -0700102
Hyunsun Moona703edf2021-07-29 15:55:15 -0700103.. attention::
Zack Williams794532a2021-03-18 17:38:36 -0700104
Hyunsun Moona703edf2021-07-29 15:55:15 -0700105 If you are adding another ACE to an existing VPN connection, go to
106 :ref:`Add ACE to an existing VPN connection <add_ace_to_vpn>`
Zack Williams794532a2021-03-18 17:38:36 -0700107
108.. _update_global_resource:
109
110Update global resource maps
111---------------------------
112
Hyunsun Moona703edf2021-07-29 15:55:15 -0700113Download aether-pod-configs repository.
114
115.. code-block:: shell
116
117 $ cd $WORKDIR
118 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-pod-configs"
119
Zack Williams794532a2021-03-18 17:38:36 -0700120Add a new ACE information at the end of the following global resource maps.
121
122* ``user_map.tfvars``
123* ``cluster_map.tfvars``
124* ``vpn_map.tfvars``
125
126As a note, you can find several other global resource maps under the
Hyunsun Moona703edf2021-07-29 15:55:15 -0700127``production`` directory. Resource definitions that need to be shared among
Zack Williams794532a2021-03-18 17:38:36 -0700128clusters or are better managed in a single file to avoid configuration
129conflicts are maintained in this way.
130
131.. code-block:: diff
132
133 $ cd $WORKDIR/aether-pod-configs/production
134 $ vi user_map.tfvars
135
136 # Add the new cluster admin user at the end of the map
137 $ git diff user_map.tfvars
138 --- a/production/user_map.tfvars
139 +++ b/production/user_map.tfvars
140 @@ user_map = {
141 username = "menlo"
142 password = "changeme"
143 global_roles = ["user-base", "catalogs-use"]
144 + },
145 + test_admin = {
146 + username = "test"
147 + password = "changeme"
148 + global_roles = ["user-base", "catalogs-use"]
149 }
150 }
151
152.. code-block:: diff
153
154 $ cd $WORKDIR/aether-pod-configs/production
155 $ vi cluster_map.tfvars
156
157 # Add the new K8S cluster information at the end of the map
158 $ git diff cluster_map.tfvars
159 --- a/production/cluster_map.tfvars
160 +++ b/production/cluster_map.tfvars
161 @@ cluster_map = {
162 kube_dns_cluster_ip = "10.53.128.10"
163 cluster_domain = "prd.menlo.aetherproject.net"
164 calico_ip_detect_method = "can-reach=www.google.com"
165 + },
166 + ace-test = {
167 + cluster_name = "ace-test"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700168 + management_subnets = ["10.32.4.0/24"]
Zack Williams794532a2021-03-18 17:38:36 -0700169 + k8s_version = "v1.18.8-rancher1-1"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700170 + k8s_pod_range = "10.33.0.0/17"
171 + k8s_cluster_ip_range = "10.33.128.0/17"
172 + kube_dns_cluster_ip = "10.33.128.10"
Zack Williams794532a2021-03-18 17:38:36 -0700173 + cluster_domain = "prd.test.aetherproject.net"
174 + calico_ip_detect_method = "can-reach=www.google.com"
175 }
176 }
177 }
178
179.. code-block:: diff
180
181 $ cd $WORKDIR/aether-pod-configs/production
182 $ vi vpn_map.tfvars
183
184 # Add VPN and tunnel information at the end of the map
185 $ git diff vpn_map.tfvars
186 --- a/production/vpn_map.tfvars
187 +++ b/production/vpn_map.tfvars
188 @@ vpn_map = {
189 bgp_peer_ip_address_1 = "169.254.0.6"
190 bgp_peer_ip_range_2 = "169.254.1.5/30"
191 bgp_peer_ip_address_2 = "169.254.1.6"
192 + },
193 + ace-test = {
194 + peer_name = "production-ace-test"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700195 + peer_vpn_gateway_address = "66.201.42.222"
Zack Williams794532a2021-03-18 17:38:36 -0700196 + tunnel_shared_secret = "UMAoZA7blv6gd3IaArDqgK2s0sDB8mlI"
197 + bgp_peer_asn = "65003"
198 + bgp_peer_ip_range_1 = "169.254.0.9/30"
199 + bgp_peer_ip_address_1 = "169.254.0.10"
200 + bgp_peer_ip_range_2 = "169.254.1.9/30"
201 + bgp_peer_ip_address_2 = "169.254.1.10"
202 }
203 }
204
205.. note::
206 Unless you have a specific requirement, set ASN and BGP addresses to the next available values in the map.
207
208
209Create ACE specific configurations
210----------------------------------
211
212In this step, we will create a directory under `production` with the same name
213as ACE, and add several Terraform configurations and Ansible inventory needed
214to configure a VPN connection.
Zack Williams794532a2021-03-18 17:38:36 -0700215Throughout the deployment procedure, this directory will contain all ACE
216specific configurations.
217
218Run the following commands to auto-generate necessary files under the target
219ACE directory.
220
221.. code-block:: shell
222
223 $ cd $WORKDIR/aether-pod-configs/tools
Hyunsun Moona703edf2021-07-29 15:55:15 -0700224 $ cp ace_config.yaml.example ace_config.yaml
225 $ vi ace_config.yaml
226 # Set all values
Zack Williams794532a2021-03-18 17:38:36 -0700227
Zack Williams794532a2021-03-18 17:38:36 -0700228 $ make vpn
229 Created ../production/ace-test
230 Created ../production/ace-test/main.tf
231 Created ../production/ace-test/variables.tf
232 Created ../production/ace-test/gcp_fw.tf
233 Created ../production/ace-test/gcp_ha_vpn.tf
234 Created ../production/ace-test/ansible
235 Created ../production/ace-test/backend.tf
236 Created ../production/ace-test/cluster_val.tfvars
237 Created ../production/ace-test/ansible/hosts.ini
238 Created ../production/ace-test/ansible/extra_vars.yml
239
Zack Williams794532a2021-03-18 17:38:36 -0700240
Hyunsun Moona703edf2021-07-29 15:55:15 -0700241Commit your change
242------------------
Zack Williams794532a2021-03-18 17:38:36 -0700243
244.. code-block:: shell
245
246 $ cd $WORKDIR/aether-pod-configs/production
247 $ git status
248 On branch tools
249 Changes not staged for commit:
250
251 modified: cluster_map.tfvars
252 modified: user_map.tfvars
253 modified: vpn_map.tfvars
254
255 Untracked files:
256 (use "git add <file>..." to include in what will be committed)
257
258 ace-test/
259
260 $ git add .
261 $ git commit -m "Add test ACE"
262 $ git review
263
264Once the review request is accepted and merged,
Hyunsun Moona703edf2021-07-29 15:55:15 -0700265the post-merge job will create VPN tunnels on both GCP and the management node.
Zack Williams794532a2021-03-18 17:38:36 -0700266
267Verify VPN connection
268---------------------
269
270You can verify the VPN connections after successful post-merge job by checking
271the routing table on the management node and trying to ping to one of the
272central cluster VMs.
273
274Make sure two tunnel interfaces, `gcp_tunnel1` and `gcp_tunnel2`, exist
275and three additional routing entries via one of the tunnel interfaces.
276
277.. code-block:: shell
278
279 # Verify routings
280 $ netstat -rn
281 Kernel IP routing table
282 Destination Gateway Genmask Flags MSS Window irtt Iface
Hyunsun Moona703edf2021-07-29 15:55:15 -0700283 0.0.0.0 66.201.42.209 0.0.0.0 UG 0 0 0 eno1
284 10.32.4.0 0.0.0.0 255.255.255.128 U 0 0 0 eno2
285 10.32.4.128 0.0.0.0 255.255.255.128 U 0 0 0 mgmt800
Zack Williams794532a2021-03-18 17:38:36 -0700286 10.45.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1
287 10.52.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1
Hyunsun Moona703edf2021-07-29 15:55:15 -0700288 10.33.128.0 10.32.4.138 255.255.128.0 UG 0 0 0 mgmt800
Zack Williams794532a2021-03-18 17:38:36 -0700289 10.168.0.0 169.254.0.9 255.255.240.0 UG 0 0 0 gcp_tunnel1
Hyunsun Moona703edf2021-07-29 15:55:15 -0700290 66.201.42.208 0.0.0.0 255.255.252.0 U 0 0 0 eno1
Zack Williams794532a2021-03-18 17:38:36 -0700291 169.254.0.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel1
292 169.254.1.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel2
293
294 # Verify ACC VM access
295 $ ping 10.168.0.6
296
Hyunsun Moona703edf2021-07-29 15:55:15 -0700297 # Verify ACC K8S Service access
Zack Williams794532a2021-03-18 17:38:36 -0700298 $ nslookup kube-dns.kube-system.svc.prd.acc.gcp.aetherproject.net 10.52.128.10
299
300You can further verify whether the ACE routes are propagated well to GCP
301by checking GCP dashboard **VPC Network > Routes > Dynamic**.
302
303
304Post VPN setup
305--------------
306
307Once you verify the VPN connections, please update `ansible` directory name to
308`_ansible` to prevent the ansible playbook from running again. Note that it is
309no harm to re-run the ansible playbook but not recommended.
310
311.. code-block:: shell
312
313 $ cd $WORKDIR/aether-pod-configs/production/$ACE_NAME
314 $ mv ansible _ansible
315 $ git add .
Hyunsun Moona703edf2021-07-29 15:55:15 -0700316 $ git commit -m "Ansible done for test ACE"
Zack Williams794532a2021-03-18 17:38:36 -0700317 $ git review
318
319.. _add_ace_to_vpn:
320
321Add another ACE to an existing VPN connection
322"""""""""""""""""""""""""""""""""""""""""""""
323
324VPN connections can be shared when there are multiple ACE clusters in a site.
325In order to add ACE to an existing VPN connection, you'll have to SSH into the
326management node and manually update BIRD configuration.
327
328.. note::
329
330 This step needs improvements in the future.
331
332.. code-block:: shell
333
334 $ sudo vi /etc/bird/bird.conf
335 protocol static {
Hyunsun Moona703edf2021-07-29 15:55:15 -0700336 # Routings for the existing cluster
Zack Williams794532a2021-03-18 17:38:36 -0700337 ...
Hyunsun Moona703edf2021-07-29 15:55:15 -0700338 route 10.33.128.0/17 via 10.32.4.138;
Zack Williams794532a2021-03-18 17:38:36 -0700339
340 # Add routings for the new ACE's K8S cluster IP range via cluster nodes
341 # TODO: Configure iBGP peering with Calico nodes and dynamically learn these routings
342 route <NEW-ACE-CLUSTER-IP> via <SERVER1>
343 route <NEW-ACE-CLUSTER-IP> via <SERVER2>
344 route <NEW-ACE-CLUSTER-IP> via <SERVER3>
345 }
346
347 filter gcp_tunnel_out {
348 # Add the new ACE's K8S cluster IP range and the management subnet if required to the list
Hyunsun Moona703edf2021-07-29 15:55:15 -0700349 if (net ~ [ 10.32.4.0/24, 10.33.128.0/17, <NEW-ACE-CLUSTER-MGMT-SUBNET>, <NEW-ACE-CLUSTER-IP-RANGE> ]) then accept;
Zack Williams794532a2021-03-18 17:38:36 -0700350 else reject;
351 }
352 # Save and exit
353
354 $ sudo birdc configure
355
356 # Confirm the static routes are added
357 $ sudo birdc show route
358