Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 1 | .. |
| 2 | SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 3 | SPDX-License-Identifier: Apache-2.0 |
| 4 | |
| 5 | VPN Bootstrap |
| 6 | ============= |
| 7 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 8 | This section guides you through setting up a VPN connection between Aether Central in GCP and ACE. |
| 9 | We will be using GitOps based Aether CI/CD system for this and all you need to do is to |
| 10 | create a couple of patches to Aether GitOps repositories. |
| 11 | Note that some of the steps described here are not directly related to setting up a VPN, |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 12 | but rather are a prerequisite for adding a new ACE. |
| 13 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 14 | Add deployment jobs |
| 15 | ------------------- |
| 16 | First, you need to add Jenkins jobs to Aether CI/CD system that build and apply |
| 17 | infrastructure change plans for the new edge. This is done by creating a patch to |
| 18 | **aether-ci-management** repository. |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 19 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 20 | Download **aether-ci-management** repository. |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 21 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 22 | .. code-block:: shell |
| 23 | |
| 24 | $ cd $WORKDIR |
| 25 | $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-ci-management" |
| 26 | |
| 27 | Add the jobs for the new cluster at the end of the `cd-pipeline-terraform-ace` project job list. |
| 28 | Make sure to add both pre-merge and post-merge jobs. |
| 29 | Note 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 | |
| 51 | Commit 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 | |
| 64 | Gather VPN information |
| 65 | ---------------------- |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 66 | |
| 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 | |
| 74 | To help your understanding, the following sample ACE environment will be used |
| 75 | in the rest of this section. Make sure to replace the sample values when you |
| 76 | actually create a review request. |
| 77 | |
| 78 | +-----------------------------+----------------------------------+ |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 79 | | Management node external IP | 66.201.42.222 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 80 | +-----------------------------+----------------------------------+ |
| 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 Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 93 | | Management Subnet | 10.32.4.0/24 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 94 | +-----------------------------+----------------------------------+ |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 95 | | K8S Subnet | Pod IP: 10.33.0.0/17 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 96 | | +----------------------------------+ |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 97 | | | Cluster IP: 10.33.128.0/17 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 98 | +-----------------------------+----------------------------------+ |
| 99 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 100 | .. 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 Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 102 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 103 | .. attention:: |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 104 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 105 | 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 Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 107 | |
Andy Bavier | 802cce5 | 2021-07-29 12:15:15 -0700 | [diff] [blame] | 108 | Get access to encrypted files in aether-pod-configs repository |
| 109 | -------------------------------------------------------------- |
| 110 | |
Andy Bavier | 718fd90 | 2021-07-30 10:10:55 -0700 | [diff] [blame^] | 111 | `git-crypt <https://github.com/AGWA/git-crypt>`_ is used to securely store encrypted files |
| 112 | in the aether-pod-configs repository. Before proceeding, (1) install git-crypt and `gpg <https://gnupg.org/>`_, |
Andy Bavier | 802cce5 | 2021-07-29 12:15:15 -0700 | [diff] [blame] | 113 | (2) create a GPG keypair, and (3) ask a member of the Aether OPs team add your public key |
| 114 | to the aether-pod-configs keyring. To create the keypair follow these steps: |
| 115 | |
| 116 | .. code-block:: shell |
| 117 | |
| 118 | $ gpg --full-generate-key |
| 119 | $ gpg --output <key-name>.gpg --armor --export <your-email-address> |
| 120 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 121 | .. _update_global_resource: |
| 122 | |
| 123 | Update global resource maps |
| 124 | --------------------------- |
| 125 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 126 | Download aether-pod-configs repository. |
| 127 | |
| 128 | .. code-block:: shell |
| 129 | |
| 130 | $ cd $WORKDIR |
| 131 | $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-pod-configs" |
Andy Bavier | 802cce5 | 2021-07-29 12:15:15 -0700 | [diff] [blame] | 132 | $ git-crypt unlock |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 133 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 134 | Add a new ACE information at the end of the following global resource maps. |
| 135 | |
| 136 | * ``user_map.tfvars`` |
| 137 | * ``cluster_map.tfvars`` |
| 138 | * ``vpn_map.tfvars`` |
| 139 | |
| 140 | As a note, you can find several other global resource maps under the |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 141 | ``production`` directory. Resource definitions that need to be shared among |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 142 | clusters or are better managed in a single file to avoid configuration |
| 143 | conflicts are maintained in this way. |
| 144 | |
| 145 | .. code-block:: diff |
| 146 | |
| 147 | $ cd $WORKDIR/aether-pod-configs/production |
| 148 | $ vi user_map.tfvars |
| 149 | |
| 150 | # Add the new cluster admin user at the end of the map |
| 151 | $ git diff user_map.tfvars |
| 152 | --- a/production/user_map.tfvars |
| 153 | +++ b/production/user_map.tfvars |
| 154 | @@ user_map = { |
| 155 | username = "menlo" |
| 156 | password = "changeme" |
| 157 | global_roles = ["user-base", "catalogs-use"] |
| 158 | + }, |
| 159 | + test_admin = { |
| 160 | + username = "test" |
| 161 | + password = "changeme" |
| 162 | + global_roles = ["user-base", "catalogs-use"] |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | .. code-block:: diff |
| 167 | |
| 168 | $ cd $WORKDIR/aether-pod-configs/production |
| 169 | $ vi cluster_map.tfvars |
| 170 | |
| 171 | # Add the new K8S cluster information at the end of the map |
| 172 | $ git diff cluster_map.tfvars |
| 173 | --- a/production/cluster_map.tfvars |
| 174 | +++ b/production/cluster_map.tfvars |
| 175 | @@ cluster_map = { |
| 176 | kube_dns_cluster_ip = "10.53.128.10" |
| 177 | cluster_domain = "prd.menlo.aetherproject.net" |
| 178 | calico_ip_detect_method = "can-reach=www.google.com" |
| 179 | + }, |
| 180 | + ace-test = { |
| 181 | + cluster_name = "ace-test" |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 182 | + management_subnets = ["10.32.4.0/24"] |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 183 | + k8s_version = "v1.18.8-rancher1-1" |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 184 | + k8s_pod_range = "10.33.0.0/17" |
| 185 | + k8s_cluster_ip_range = "10.33.128.0/17" |
| 186 | + kube_dns_cluster_ip = "10.33.128.10" |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 187 | + cluster_domain = "prd.test.aetherproject.net" |
| 188 | + calico_ip_detect_method = "can-reach=www.google.com" |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | .. code-block:: diff |
| 194 | |
| 195 | $ cd $WORKDIR/aether-pod-configs/production |
| 196 | $ vi vpn_map.tfvars |
| 197 | |
| 198 | # Add VPN and tunnel information at the end of the map |
| 199 | $ git diff vpn_map.tfvars |
| 200 | --- a/production/vpn_map.tfvars |
| 201 | +++ b/production/vpn_map.tfvars |
| 202 | @@ vpn_map = { |
| 203 | bgp_peer_ip_address_1 = "169.254.0.6" |
| 204 | bgp_peer_ip_range_2 = "169.254.1.5/30" |
| 205 | bgp_peer_ip_address_2 = "169.254.1.6" |
| 206 | + }, |
| 207 | + ace-test = { |
| 208 | + peer_name = "production-ace-test" |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 209 | + peer_vpn_gateway_address = "66.201.42.222" |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 210 | + tunnel_shared_secret = "UMAoZA7blv6gd3IaArDqgK2s0sDB8mlI" |
| 211 | + bgp_peer_asn = "65003" |
| 212 | + bgp_peer_ip_range_1 = "169.254.0.9/30" |
| 213 | + bgp_peer_ip_address_1 = "169.254.0.10" |
| 214 | + bgp_peer_ip_range_2 = "169.254.1.9/30" |
| 215 | + bgp_peer_ip_address_2 = "169.254.1.10" |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | .. note:: |
| 220 | Unless you have a specific requirement, set ASN and BGP addresses to the next available values in the map. |
| 221 | |
| 222 | |
| 223 | Create ACE specific configurations |
| 224 | ---------------------------------- |
| 225 | |
| 226 | In this step, we will create a directory under `production` with the same name |
| 227 | as ACE, and add several Terraform configurations and Ansible inventory needed |
| 228 | to configure a VPN connection. |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 229 | Throughout the deployment procedure, this directory will contain all ACE |
| 230 | specific configurations. |
| 231 | |
| 232 | Run the following commands to auto-generate necessary files under the target |
| 233 | ACE directory. |
| 234 | |
| 235 | .. code-block:: shell |
| 236 | |
| 237 | $ cd $WORKDIR/aether-pod-configs/tools |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 238 | $ cp ace_config.yaml.example ace_config.yaml |
| 239 | $ vi ace_config.yaml |
| 240 | # Set all values |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 241 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 242 | $ make vpn |
| 243 | Created ../production/ace-test |
| 244 | Created ../production/ace-test/main.tf |
| 245 | Created ../production/ace-test/variables.tf |
| 246 | Created ../production/ace-test/gcp_fw.tf |
| 247 | Created ../production/ace-test/gcp_ha_vpn.tf |
| 248 | Created ../production/ace-test/ansible |
| 249 | Created ../production/ace-test/backend.tf |
| 250 | Created ../production/ace-test/cluster_val.tfvars |
| 251 | Created ../production/ace-test/ansible/hosts.ini |
| 252 | Created ../production/ace-test/ansible/extra_vars.yml |
| 253 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 254 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 255 | Commit your change |
| 256 | ------------------ |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 257 | |
| 258 | .. code-block:: shell |
| 259 | |
| 260 | $ cd $WORKDIR/aether-pod-configs/production |
| 261 | $ git status |
| 262 | On branch tools |
| 263 | Changes not staged for commit: |
| 264 | |
| 265 | modified: cluster_map.tfvars |
| 266 | modified: user_map.tfvars |
| 267 | modified: vpn_map.tfvars |
| 268 | |
| 269 | Untracked files: |
| 270 | (use "git add <file>..." to include in what will be committed) |
| 271 | |
| 272 | ace-test/ |
| 273 | |
| 274 | $ git add . |
| 275 | $ git commit -m "Add test ACE" |
| 276 | $ git review |
| 277 | |
| 278 | Once the review request is accepted and merged, |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 279 | the post-merge job will create VPN tunnels on both GCP and the management node. |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 280 | |
| 281 | Verify VPN connection |
| 282 | --------------------- |
| 283 | |
| 284 | You can verify the VPN connections after successful post-merge job by checking |
| 285 | the routing table on the management node and trying to ping to one of the |
| 286 | central cluster VMs. |
| 287 | |
| 288 | Make sure two tunnel interfaces, `gcp_tunnel1` and `gcp_tunnel2`, exist |
| 289 | and three additional routing entries via one of the tunnel interfaces. |
| 290 | |
| 291 | .. code-block:: shell |
| 292 | |
| 293 | # Verify routings |
| 294 | $ netstat -rn |
| 295 | Kernel IP routing table |
| 296 | Destination Gateway Genmask Flags MSS Window irtt Iface |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 297 | 0.0.0.0 66.201.42.209 0.0.0.0 UG 0 0 0 eno1 |
| 298 | 10.32.4.0 0.0.0.0 255.255.255.128 U 0 0 0 eno2 |
| 299 | 10.32.4.128 0.0.0.0 255.255.255.128 U 0 0 0 mgmt800 |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 300 | 10.45.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1 |
| 301 | 10.52.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1 |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 302 | 10.33.128.0 10.32.4.138 255.255.128.0 UG 0 0 0 mgmt800 |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 303 | 10.168.0.0 169.254.0.9 255.255.240.0 UG 0 0 0 gcp_tunnel1 |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 304 | 66.201.42.208 0.0.0.0 255.255.252.0 U 0 0 0 eno1 |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 305 | 169.254.0.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel1 |
| 306 | 169.254.1.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel2 |
| 307 | |
| 308 | # Verify ACC VM access |
| 309 | $ ping 10.168.0.6 |
| 310 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 311 | # Verify ACC K8S Service access |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 312 | $ nslookup kube-dns.kube-system.svc.prd.acc.gcp.aetherproject.net 10.52.128.10 |
| 313 | |
| 314 | You can further verify whether the ACE routes are propagated well to GCP |
| 315 | by checking GCP dashboard **VPC Network > Routes > Dynamic**. |
| 316 | |
| 317 | |
| 318 | Post VPN setup |
| 319 | -------------- |
| 320 | |
| 321 | Once you verify the VPN connections, please update `ansible` directory name to |
| 322 | `_ansible` to prevent the ansible playbook from running again. Note that it is |
| 323 | no harm to re-run the ansible playbook but not recommended. |
| 324 | |
| 325 | .. code-block:: shell |
| 326 | |
| 327 | $ cd $WORKDIR/aether-pod-configs/production/$ACE_NAME |
| 328 | $ mv ansible _ansible |
| 329 | $ git add . |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 330 | $ git commit -m "Ansible done for test ACE" |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 331 | $ git review |
| 332 | |
| 333 | .. _add_ace_to_vpn: |
| 334 | |
| 335 | Add another ACE to an existing VPN connection |
| 336 | """"""""""""""""""""""""""""""""""""""""""""" |
| 337 | |
| 338 | VPN connections can be shared when there are multiple ACE clusters in a site. |
| 339 | In order to add ACE to an existing VPN connection, you'll have to SSH into the |
| 340 | management node and manually update BIRD configuration. |
| 341 | |
| 342 | .. note:: |
| 343 | |
| 344 | This step needs improvements in the future. |
| 345 | |
| 346 | .. code-block:: shell |
| 347 | |
| 348 | $ sudo vi /etc/bird/bird.conf |
| 349 | protocol static { |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 350 | # Routings for the existing cluster |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 351 | ... |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 352 | route 10.33.128.0/17 via 10.32.4.138; |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 353 | |
| 354 | # Add routings for the new ACE's K8S cluster IP range via cluster nodes |
| 355 | # TODO: Configure iBGP peering with Calico nodes and dynamically learn these routings |
| 356 | route <NEW-ACE-CLUSTER-IP> via <SERVER1> |
| 357 | route <NEW-ACE-CLUSTER-IP> via <SERVER2> |
| 358 | route <NEW-ACE-CLUSTER-IP> via <SERVER3> |
| 359 | } |
| 360 | |
| 361 | filter gcp_tunnel_out { |
| 362 | # Add the new ACE's K8S cluster IP range and the management subnet if required to the list |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 363 | 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 Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 364 | else reject; |
| 365 | } |
| 366 | # Save and exit |
| 367 | |
| 368 | $ sudo birdc configure |
| 369 | |
| 370 | # Confirm the static routes are added |
| 371 | $ sudo birdc show route |
| 372 | |