Hung-Wei Chiu | 77c969e | 2020-10-23 18:13:07 +0000 | [diff] [blame] | 1 | .. |
| 2 | SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 3 | SPDX-License-Identifier: Apache-2.0 |
| 4 | |
Hyunsun Moon | 049b505 | 2021-07-30 12:41:03 -0700 | [diff] [blame] | 5 | Runtime Deployment |
| 6 | ================== |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 7 | |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 8 | This section describes how to install and configure Aether Edge Runtime including Kubernetes |
| 9 | and system level applications listed below. |
| 10 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 11 | * ``sealed-secrets`` |
| 12 | * ``rancher-monitoring`` |
| 13 | * ``fluent-bit`` |
| 14 | * ``opendistro-es`` |
| 15 | * ``hostpath-provisioner`` |
| 16 | * ``edge-maintenance-agent`` |
| 17 | * ``sriov-device-plugin`` |
| 18 | * ``uedns`` |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 19 | |
| 20 | For this, we will be using GitOps based CI/CD systems and what you will need to do is |
| 21 | create patches in Aether GitOps repositories, **aether-pod-configs** and **aether-app-configs**, |
Hyunsun Moon | bbad67d | 2021-08-12 00:47:27 -0700 | [diff] [blame] | 22 | to provide cluster and application configurations to the CI/CD systems. |
Hyunsun Moon | 049b505 | 2021-07-30 12:41:03 -0700 | [diff] [blame] | 23 | |
| 24 | .. attention:: |
| 25 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 26 | If you skipped VPN bootstrap step and didn't add the deployment jobs for the new edge, |
Hyunsun Moon | 049b505 | 2021-07-30 12:41:03 -0700 | [diff] [blame] | 27 | go to :ref:`Add deployment jobs <add_deployment_jobs>` step and finish it first |
| 28 | before proceeding. |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 29 | |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 30 | K8S cluster deployment |
| 31 | ---------------------- |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 32 | |
Hyunsun Moon | 049b505 | 2021-07-30 12:41:03 -0700 | [diff] [blame] | 33 | Download ``aether-pod-configs`` repository if you don't have it already in |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 34 | your development machine. |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 35 | |
| 36 | .. code-block:: shell |
| 37 | |
| 38 | $ cd $WORKDIR |
| 39 | $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-pod-configs" |
| 40 | |
Hyunsun Moon | 5c1e0b0 | 2020-11-20 11:09:00 -0800 | [diff] [blame] | 41 | .. attention:: |
| 42 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 43 | If you skipped VPN bootstrap step and didn't update global resource maps for the new edge, |
Hyunsun Moon | 049b505 | 2021-07-30 12:41:03 -0700 | [diff] [blame] | 44 | go to :ref:`Update global resource maps <update_global_resource>` step and |
| 45 | finish ``cluster_map.tfvars`` and ``user_map.tfvars`` update first before proceeding. |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 46 | |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 47 | Run the following commands to automatically generate Terraform configurations needed to |
| 48 | create a new cluster in `Rancher <https://rancher.aetherproject.org>`_ and add the servers |
| 49 | and switches to the cluster. |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 50 | |
| 51 | .. code-block:: shell |
| 52 | |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 53 | # Create ace_cofig.yaml file if you haven't yet |
Hyunsun Moon | a79c742 | 2020-11-18 04:52:56 -0800 | [diff] [blame] | 54 | $ cd $WORKDIR/aether-pod-configs/tools |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 55 | $ cp ace_config.yaml.example ace_config.yaml |
| 56 | $ vi ace_config.yaml |
| 57 | # Set all values |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 58 | |
Hyunsun Moon | a79c742 | 2020-11-18 04:52:56 -0800 | [diff] [blame] | 59 | $ make runtime |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 60 | Created ../production/ace-test/provider.tf |
Hyunsun Moon | 049b505 | 2021-07-30 12:41:03 -0700 | [diff] [blame] | 61 | Created ../production/ace-test/cluster.tf |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 62 | Created ../production/ace-test/rke-bare-metal.tf |
| 63 | Created ../production/ace-test/addon-manifests.yml.tpl |
| 64 | Created ../production/ace-test/project.tf |
Hyunsun Moon | 049b505 | 2021-07-30 12:41:03 -0700 | [diff] [blame] | 65 | Created ../production/ace-test/member.tf |
| 66 | Created ../production/ace-test/backend.tf |
| 67 | Created ../production/ace-test/cluster_val.tfvars |
Hyunsun Moon | a703edf | 2021-07-29 15:55:15 -0700 | [diff] [blame] | 68 | |
Hyunsun Moon | c67d8fc | 2021-08-12 01:06:29 -0700 | [diff] [blame] | 69 | .. attention:: |
| 70 | |
| 71 | If the cluster has an even number of compute nodes, edit **cluster_val.tfvars** |
| 72 | file so that only the odd number of nodes have **etcd** and **controlplane** |
| 73 | roles. |
| 74 | |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 75 | Create a review request. |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 76 | |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 77 | .. code-block:: shell |
| 78 | |
Hyunsun Moon | a79c742 | 2020-11-18 04:52:56 -0800 | [diff] [blame] | 79 | $ cd $WORKDIR/aether-pod-configs |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 80 | $ git add . |
Hyunsun Moon | a79c742 | 2020-11-18 04:52:56 -0800 | [diff] [blame] | 81 | $ git commit -m "Add test ACE runtime configs" |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 82 | $ git review |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 83 | |
| 84 | Once your review request is accepted and merged, Aether CI/CD system starts to deploy K8S. |
| 85 | Wait until the cluster status changes to **Active** in `Rancher <https://rancher.aetherproject.org>`_. |
| 86 | It normally takes 10 - 15 minutes depending on the speed of the container images |
| 87 | download at the edge. |
| 88 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 89 | It is also a good idea to check the system pod status after successful K8S deployment. |
| 90 | To do so, login to Rancher, open the cluster that you just deployed in the **Global** view, and click |
| 91 | **Launch kubectl** button. You can interact with the cluster using the window that opens. |
| 92 | Run the following commands and make sure all pods are ``Running``. |
| 93 | |
| 94 | .. code-block:: shell |
| 95 | |
| 96 | # Run kubectl commands inside here |
| 97 | # e.g. kubectl get all |
| 98 | > kubectl get po -A |
| 99 | |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 100 | System Application Deployment |
| 101 | ----------------------------- |
| 102 | |
| 103 | For the system application deployment, we will be using Rancher's built-in GitOps tool, **Fleet**. |
| 104 | Fleet uses a git repository as a single source of truth to manage applications in the clusters. |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 105 | For Aether, **aether-app-configs** is the repository where all Aether applications |
| 106 | are defined. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 107 | |
| 108 | Most of the Aether system applications do not require cluster specific configurations, |
| 109 | except **rancher-monitoring** and **uedns**. |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 110 | For these applications, you will have to manually create custom configurations and |
| 111 | commit them to aether-app-configs. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 112 | |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 113 | First, download ``aether-app-configs`` if you don't have it already in your development machine. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 114 | |
| 115 | .. code-block:: shell |
| 116 | |
| 117 | $ cd $WORKDIR |
| 118 | $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-app-configs" |
| 119 | |
| 120 | Configure rancher-monitoring |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 121 | """""""""""""""""""""""""""" |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 122 | |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 123 | Open ``fleet.yaml`` under ``infrastructure/rancher-monitoring``, add a custom target |
| 124 | with the new cluster name as a selector, and provide cluster specific Helm values and |
| 125 | kustomize overlay directory path like below. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 126 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 127 | .. code-block:: yaml |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 128 | |
| 129 | $ cd $WORKDIR/aether-app-configs/infrastructure/rancher-monitoring |
| 130 | $ vi fleet.yaml |
| 131 | # add following block at the end |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 132 | - name: ace-test |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 133 | clusterSelector: |
| 134 | matchLabels: |
| 135 | management.cattle.io/cluster-display-name: ace-test |
| 136 | helm: |
| 137 | values: |
| 138 | prometheus: |
| 139 | prometheusSpec: |
| 140 | additionalAlertRelabelConfigs: |
| 141 | - source_labels: [__address__] |
| 142 | target_label: cluster |
| 143 | replacement: ace-test |
| 144 | kustomize: |
| 145 | dir: overlays/prd-ace |
| 146 | |
| 147 | .. note:: |
| 148 | |
| 149 | Above step will not be required in Rancher v2.6 as it supports using cluster labels as helm values in a list. |
| 150 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 151 | Configure ``ue-dns`` |
| 152 | """""""""""""""""""" |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 153 | |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 154 | For UE-DNS, it is required to create a Helm values file for the new cluster. |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 155 | You'll need cluster domain and ``kube-dns`` ClusterIP. Both can be found in |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 156 | ``aether-pod-configs/production/cluster_map.tfvars``. |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 157 | Be sure to replace ``[ ]`` in the example configuration below to the actual cluster values. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 158 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 159 | .. code-block:: yaml |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 160 | |
| 161 | $ cd $WORKDIR/aether-app-configs/infrastructure/coredns |
| 162 | $ mkdir overlays/prd-ace-test |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 163 | $ vi overlays/prd-ace-test/values.yaml |
| 164 | # SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org> |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 165 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 166 | serviceType: ClusterIP |
| 167 | service: |
| 168 | clusterIP: [next address of the kube-dns ip] |
| 169 | servers: |
| 170 | - zones: |
| 171 | - zone: . |
| 172 | port: 53 |
| 173 | plugins: |
| 174 | - name: errors |
| 175 | - name: health |
| 176 | configBlock: |- |
| 177 | lameduck 5s |
| 178 | - name: ready |
| 179 | - name: prometheus |
| 180 | parameters: 0.0.0.0:9153 |
| 181 | - name: forward |
| 182 | parameters: . /etc/resolv.conf |
| 183 | - name: cache |
| 184 | parameters: 30 |
| 185 | - name: loop |
| 186 | - name: reload |
| 187 | - name: loadbalance |
| 188 | - zones: |
| 189 | - zone: aetherproject.net |
| 190 | port: 53 |
| 191 | plugins: |
| 192 | - name: errors |
| 193 | - name: rewrite continue |
| 194 | configBlock: |- |
| 195 | name regex (.*)\.aetherproject.net {1}.svc.[cluster domain] |
| 196 | answer name (.*)\.svc\.[cluster domain] {1}.aetherproject.net |
| 197 | - name: forward |
| 198 | parameters: . [kube-dns ip] |
| 199 | configBlock: |- |
| 200 | except kube-system.svc.[cluster domain] aether-sdcore.svc.[cluster domain] tost.svc.[cluster domain] |
| 201 | - name: cache |
| 202 | parameters: 30 |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 203 | |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 204 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 205 | Next, update ``fleet.yaml`` under ``infrastructure/coredns`` so that Fleet can use the custom configuration |
| 206 | you just created when deploying UE-DNS to the cluster. |
| 207 | |
| 208 | .. code-block:: yaml |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 209 | |
| 210 | $ cd $WORKDIR/aether-app-configs/infrastructure/coredns |
| 211 | $ vi fleet.yaml |
| 212 | # add following block at the end |
| 213 | - name: prd-ace-test |
| 214 | clusterSelector: |
| 215 | matchLabels: |
| 216 | management.cattle.io/cluster-display-name: ace-test |
| 217 | helm: |
| 218 | valuesFiles: |
| 219 | - overlays/prd-ace-test/values.yaml |
| 220 | |
| 221 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 222 | Submit your changes. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 223 | |
| 224 | .. code-block:: shell |
| 225 | |
| 226 | $ cd $WORKDIR/aether-app-configs |
| 227 | $ git status |
| 228 | $ git add . |
| 229 | $ git commit -m "Add test ACE application configs" |
| 230 | $ git review |
| 231 | |
| 232 | |
| 233 | Assign Fleet workspace |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 234 | """""""""""""""""""""" |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 235 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 236 | By default, all new clusters are assigned to a default Fleet workspace called **fleet-default**. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 237 | To make a cluster part of Aether and have the applications defined in aether-app-configs deployed, |
| 238 | you must assign the cluster to either **aether-stable** or **aether-alpha** workspace. |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 239 | For clusters expecting minimal downtime, assign to **aether-stable**. |
| 240 | For clusters for development or previewing upcoming release, assign to **aether-alpha**. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 241 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 242 | Workspace assignment can be done from Fleet dashboard. |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 243 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 244 | To access Fleet dashboard, log in to `Rancher <https://rancher.aetherproject.org>`_ as |
| 245 | ``admin`` or ``onfadmin`` user, go to the **Cluster Explorer**, |
| 246 | and click **Cluster Explorer > Continuous Delivery** in the top left dropdown menu. |
| 247 | Now, perform the following steps to assign the new cluster to one of the Aether workspaces. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 248 | |
| 249 | .. image:: images/fleet-move-workspace.png |
| 250 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 251 | 1) Click the second dropdown menu from the left at the top and switch the current workspace |
| 252 | to **fleet-default**. |
| 253 | 2) Click **Clusters** on the left menu. |
| 254 | 3) Select the cluster. |
| 255 | 4) Click **Assign to...** button and choose **aether-stable** or **aether-alpha** |
| 256 | in from the popup menu. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 257 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 258 | To verify, switch the current workspace to the workspace the cluster is assigned to, |
| 259 | click **Clusters** in the left menu, and check if the cluster exists. |
| 260 | Wait for the system application deployment to complete and the cluster state |
| 261 | to become **Active**. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 262 | |
| 263 | .. attention:: |
| 264 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 265 | Ignore BESS UPF failure at this point if BESS UPF is enabled. |