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 | |
| 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 |
| 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 | |
| 26 | If you skipped VPN bootstap step and didn't add the deployment jobs for the new edge, |
| 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 | |
Hyunsun Moon | 049b505 | 2021-07-30 12:41:03 -0700 | [diff] [blame] | 43 | If you skipped VPN bootstap step and didn't update global resource maps for the new edge, |
| 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 | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 69 | Create a review request. |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 70 | |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 71 | .. code-block:: shell |
| 72 | |
Hyunsun Moon | a79c742 | 2020-11-18 04:52:56 -0800 | [diff] [blame] | 73 | $ cd $WORKDIR/aether-pod-configs |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 74 | $ git add . |
Hyunsun Moon | a79c742 | 2020-11-18 04:52:56 -0800 | [diff] [blame] | 75 | $ git commit -m "Add test ACE runtime configs" |
Hyunsun Moon | 5ca6bfb | 2020-10-29 22:29:12 -0700 | [diff] [blame] | 76 | $ git review |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 77 | |
| 78 | Once your review request is accepted and merged, Aether CI/CD system starts to deploy K8S. |
| 79 | Wait until the cluster status changes to **Active** in `Rancher <https://rancher.aetherproject.org>`_. |
| 80 | It normally takes 10 - 15 minutes depending on the speed of the container images |
| 81 | download at the edge. |
| 82 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 83 | It is also a good idea to check the system pod status after successful K8S deployment. |
| 84 | To do so, login to Rancher, open the cluster that you just deployed in the **Global** view, and click |
| 85 | **Launch kubectl** button. You can interact with the cluster using the window that opens. |
| 86 | Run the following commands and make sure all pods are ``Running``. |
| 87 | |
| 88 | .. code-block:: shell |
| 89 | |
| 90 | # Run kubectl commands inside here |
| 91 | # e.g. kubectl get all |
| 92 | > kubectl get po -A |
| 93 | |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 94 | System Application Deployment |
| 95 | ----------------------------- |
| 96 | |
| 97 | For the system application deployment, we will be using Rancher's built-in GitOps tool, **Fleet**. |
| 98 | 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] | 99 | For Aether, **aether-app-configs** is the repository where all Aether applications |
| 100 | are defined. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 101 | |
| 102 | Most of the Aether system applications do not require cluster specific configurations, |
| 103 | except **rancher-monitoring** and **uedns**. |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 104 | For these applications, you will have to manually create custom configurations and |
| 105 | commit them to aether-app-configs. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 106 | |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 107 | 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] | 108 | |
| 109 | .. code-block:: shell |
| 110 | |
| 111 | $ cd $WORKDIR |
| 112 | $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-app-configs" |
| 113 | |
| 114 | Configure rancher-monitoring |
| 115 | ############################ |
| 116 | |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 117 | Open ``fleet.yaml`` under ``infrastructure/rancher-monitoring``, add a custom target |
| 118 | with the new cluster name as a selector, and provide cluster specific Helm values and |
| 119 | kustomize overlay directory path like below. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 120 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 121 | .. code-block:: yaml |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 122 | |
| 123 | $ cd $WORKDIR/aether-app-configs/infrastructure/rancher-monitoring |
| 124 | $ vi fleet.yaml |
| 125 | # add following block at the end |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 126 | - name: ace-test |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 127 | clusterSelector: |
| 128 | matchLabels: |
| 129 | management.cattle.io/cluster-display-name: ace-test |
| 130 | helm: |
| 131 | values: |
| 132 | prometheus: |
| 133 | prometheusSpec: |
| 134 | additionalAlertRelabelConfigs: |
| 135 | - source_labels: [__address__] |
| 136 | target_label: cluster |
| 137 | replacement: ace-test |
| 138 | kustomize: |
| 139 | dir: overlays/prd-ace |
| 140 | |
| 141 | .. note:: |
| 142 | |
| 143 | Above step will not be required in Rancher v2.6 as it supports using cluster labels as helm values in a list. |
| 144 | |
| 145 | Configure ue-dns |
| 146 | ################ |
| 147 | |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 148 | For UE-DNS, it is required to create a Helm values file for the new cluster. |
| 149 | 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] | 150 | ``aether-pod-configs/production/cluster_map.tfvars``. |
Hyunsun Moon | b9c7dde | 2021-08-01 06:11:08 -0700 | [diff] [blame] | 151 | 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] | 152 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 153 | .. code-block:: yaml |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 154 | |
| 155 | $ cd $WORKDIR/aether-app-configs/infrastructure/coredns |
| 156 | $ mkdir overlays/prd-ace-test |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 157 | $ vi overlays/prd-ace-test/values.yaml |
| 158 | # SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org> |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 159 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 160 | serviceType: ClusterIP |
| 161 | service: |
| 162 | clusterIP: [next address of the kube-dns ip] |
| 163 | servers: |
| 164 | - zones: |
| 165 | - zone: . |
| 166 | port: 53 |
| 167 | plugins: |
| 168 | - name: errors |
| 169 | - name: health |
| 170 | configBlock: |- |
| 171 | lameduck 5s |
| 172 | - name: ready |
| 173 | - name: prometheus |
| 174 | parameters: 0.0.0.0:9153 |
| 175 | - name: forward |
| 176 | parameters: . /etc/resolv.conf |
| 177 | - name: cache |
| 178 | parameters: 30 |
| 179 | - name: loop |
| 180 | - name: reload |
| 181 | - name: loadbalance |
| 182 | - zones: |
| 183 | - zone: aetherproject.net |
| 184 | port: 53 |
| 185 | plugins: |
| 186 | - name: errors |
| 187 | - name: rewrite continue |
| 188 | configBlock: |- |
| 189 | name regex (.*)\.aetherproject.net {1}.svc.[cluster domain] |
| 190 | answer name (.*)\.svc\.[cluster domain] {1}.aetherproject.net |
| 191 | - name: forward |
| 192 | parameters: . [kube-dns ip] |
| 193 | configBlock: |- |
| 194 | except kube-system.svc.[cluster domain] aether-sdcore.svc.[cluster domain] tost.svc.[cluster domain] |
| 195 | - name: cache |
| 196 | parameters: 30 |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 197 | |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 198 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 199 | Next, update ``fleet.yaml`` under ``infrastructure/coredns`` so that Fleet can use the custom configuration |
| 200 | you just created when deploying UE-DNS to the cluster. |
| 201 | |
| 202 | .. code-block:: yaml |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 203 | |
| 204 | $ cd $WORKDIR/aether-app-configs/infrastructure/coredns |
| 205 | $ vi fleet.yaml |
| 206 | # add following block at the end |
| 207 | - name: prd-ace-test |
| 208 | clusterSelector: |
| 209 | matchLabels: |
| 210 | management.cattle.io/cluster-display-name: ace-test |
| 211 | helm: |
| 212 | valuesFiles: |
| 213 | - overlays/prd-ace-test/values.yaml |
| 214 | |
| 215 | |
Hyunsun Moon | 2b2bf9a | 2021-08-01 05:29:48 -0700 | [diff] [blame] | 216 | Submit your changes. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 217 | |
| 218 | .. code-block:: shell |
| 219 | |
| 220 | $ cd $WORKDIR/aether-app-configs |
| 221 | $ git status |
| 222 | $ git add . |
| 223 | $ git commit -m "Add test ACE application configs" |
| 224 | $ git review |
| 225 | |
| 226 | |
| 227 | Assign Fleet workspace |
| 228 | ###################### |
| 229 | |
| 230 | By default, all new clusters are assgiend to a default Fleet workspace called **fleet-default**. |
| 231 | To make a cluster part of Aether and have the applications defined in aether-app-configs deployed, |
| 232 | 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] | 233 | For clusters expecting minimal downtime, assign to **aether-stable**. |
| 234 | For clusters for development or previewing upcoming release, assign to **aether-alpha**. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 235 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 236 | Workspace assignment can be done from Fleet dashboard. |
| 237 | To access Fleet dashboard, log in to `Rancher <https://rancher.aetherproject.org>`_ as |
| 238 | ``admin`` or ``onfadmin`` user, go to the **Cluster Explorer**, |
| 239 | and click **Cluster Explorer > Continuous Delivery** in the top left dropdown menu. |
| 240 | 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] | 241 | |
| 242 | .. image:: images/fleet-move-workspace.png |
| 243 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 244 | 1) Click the second dropdown menu from the left at the top and switch the current workspace |
| 245 | to **fleet-default**. |
| 246 | 2) Click **Clusters** on the left menu. |
| 247 | 3) Select the cluster. |
| 248 | 4) Click **Assign to...** button and choose **aether-stable** or **aether-alpha** |
| 249 | in from the popup menu. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 250 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 251 | To verify, switch the current workspace to the workspace the cluster is assigned to, |
| 252 | click **Clusters** in the left menu, and check if the cluster exists. |
| 253 | Wait for the system application deployment to complete and the cluster state |
| 254 | to become **Active**. |
Hyunsun Moon | d12f32b | 2021-07-30 12:55:00 -0700 | [diff] [blame] | 255 | |
| 256 | .. attention:: |
| 257 | |
Hyunsun Moon | 35868bc | 2021-08-11 15:01:13 -0700 | [diff] [blame] | 258 | Ignore BESS UPF failure at this point if BESS UPF is enabled. |