blob: 19935d966556873c8c8a686cd0f4824161f5d8a5 [file] [log] [blame]
Hung-Wei Chiu77c969e2020-10-23 18:13:07 +00001..
2 SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
3 SPDX-License-Identifier: Apache-2.0
4
Hyunsun Moon049b5052021-07-30 12:41:03 -07005Runtime Deployment
6==================
Zack Williams794532a2021-03-18 17:38:36 -07007
Hyunsun Moond12f32b2021-07-30 12:55:00 -07008This section describes how to install and configure Aether Edge Runtime including Kubernetes
9and system level applications listed below.
10
Zack Williams1ae109e2021-07-27 11:17:04 -070011* ``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 Moond12f32b2021-07-30 12:55:00 -070019
20For this, we will be using GitOps based CI/CD systems and what you will need to do is
21create patches in Aether GitOps repositories, **aether-pod-configs** and **aether-app-configs**,
Hyunsun Moonbbad67d2021-08-12 00:47:27 -070022to provide cluster and application configurations to the CI/CD systems.
Hyunsun Moon049b5052021-07-30 12:41:03 -070023
24.. attention::
25
Zack Williams1ae109e2021-07-27 11:17:04 -070026 If you skipped VPN bootstrap step and didn't add the deployment jobs for the new edge,
Hyunsun Moon049b5052021-07-30 12:41:03 -070027 go to :ref:`Add deployment jobs <add_deployment_jobs>` step and finish it first
28 before proceeding.
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070029
Hyunsun Moond12f32b2021-07-30 12:55:00 -070030K8S cluster deployment
31----------------------
Zack Williams794532a2021-03-18 17:38:36 -070032
Hyunsun Moon049b5052021-07-30 12:41:03 -070033Download ``aether-pod-configs`` repository if you don't have it already in
Zack Williams794532a2021-03-18 17:38:36 -070034your development machine.
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070035
36.. code-block:: shell
37
38 $ cd $WORKDIR
39 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-pod-configs"
40
Hyunsun Moon5c1e0b02020-11-20 11:09:00 -080041.. attention::
42
Zack Williams1ae109e2021-07-27 11:17:04 -070043 If you skipped VPN bootstrap step and didn't update global resource maps for the new edge,
Hyunsun Moon049b5052021-07-30 12:41:03 -070044 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 Williams794532a2021-03-18 17:38:36 -070046
Hyunsun Moond12f32b2021-07-30 12:55:00 -070047Run the following commands to automatically generate Terraform configurations needed to
48create a new cluster in `Rancher <https://rancher.aetherproject.org>`_ and add the servers
49and switches to the cluster.
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070050
51.. code-block:: shell
52
Hyunsun Moona703edf2021-07-29 15:55:15 -070053 # Create ace_cofig.yaml file if you haven't yet
Hyunsun Moona79c7422020-11-18 04:52:56 -080054 $ cd $WORKDIR/aether-pod-configs/tools
Hyunsun Moona703edf2021-07-29 15:55:15 -070055 $ cp ace_config.yaml.example ace_config.yaml
56 $ vi ace_config.yaml
57 # Set all values
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070058
Hyunsun Moona79c7422020-11-18 04:52:56 -080059 $ make runtime
Hyunsun Moona703edf2021-07-29 15:55:15 -070060 Created ../production/ace-test/provider.tf
Hyunsun Moon049b5052021-07-30 12:41:03 -070061 Created ../production/ace-test/cluster.tf
Hyunsun Moona703edf2021-07-29 15:55:15 -070062 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 Moon049b5052021-07-30 12:41:03 -070065 Created ../production/ace-test/member.tf
66 Created ../production/ace-test/backend.tf
67 Created ../production/ace-test/cluster_val.tfvars
Hyunsun Moona703edf2021-07-29 15:55:15 -070068
Hyunsun Moonc67d8fc2021-08-12 01:06:29 -070069.. 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 Moond12f32b2021-07-30 12:55:00 -070075Create a review request.
Zack Williams794532a2021-03-18 17:38:36 -070076
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070077.. code-block:: shell
78
Hyunsun Moona79c7422020-11-18 04:52:56 -080079 $ cd $WORKDIR/aether-pod-configs
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070080 $ git add .
Hyunsun Moona79c7422020-11-18 04:52:56 -080081 $ git commit -m "Add test ACE runtime configs"
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070082 $ git review
Hyunsun Moond12f32b2021-07-30 12:55:00 -070083
84Once your review request is accepted and merged, Aether CI/CD system starts to deploy K8S.
85Wait until the cluster status changes to **Active** in `Rancher <https://rancher.aetherproject.org>`_.
86It normally takes 10 - 15 minutes depending on the speed of the container images
87download at the edge.
88
Hyunsun Moon35868bc2021-08-11 15:01:13 -070089It is also a good idea to check the system pod status after successful K8S deployment.
90To 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.
92Run 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 Moond12f32b2021-07-30 12:55:00 -0700100System Application Deployment
101-----------------------------
102
103For the system application deployment, we will be using Rancher's built-in GitOps tool, **Fleet**.
104Fleet uses a git repository as a single source of truth to manage applications in the clusters.
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700105For Aether, **aether-app-configs** is the repository where all Aether applications
106are defined.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700107
108Most of the Aether system applications do not require cluster specific configurations,
109except **rancher-monitoring** and **uedns**.
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700110For these applications, you will have to manually create custom configurations and
111commit them to aether-app-configs.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700112
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700113First, download ``aether-app-configs`` if you don't have it already in your development machine.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700114
115.. code-block:: shell
116
117 $ cd $WORKDIR
118 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-app-configs"
119
120Configure rancher-monitoring
Zack Williams1ae109e2021-07-27 11:17:04 -0700121""""""""""""""""""""""""""""
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700122
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700123Open ``fleet.yaml`` under ``infrastructure/rancher-monitoring``, add a custom target
124with the new cluster name as a selector, and provide cluster specific Helm values and
125kustomize overlay directory path like below.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700126
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700127.. code-block:: yaml
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700128
129 $ cd $WORKDIR/aether-app-configs/infrastructure/rancher-monitoring
130 $ vi fleet.yaml
131 # add following block at the end
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700132 - name: ace-test
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700133 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 Williams1ae109e2021-07-27 11:17:04 -0700151Configure ``ue-dns``
152""""""""""""""""""""
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700153
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700154For UE-DNS, it is required to create a Helm values file for the new cluster.
Zack Williams1ae109e2021-07-27 11:17:04 -0700155You'll need cluster domain and ``kube-dns`` ClusterIP. Both can be found in
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700156``aether-pod-configs/production/cluster_map.tfvars``.
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700157Be sure to replace ``[ ]`` in the example configuration below to the actual cluster values.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700158
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700159.. code-block:: yaml
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700160
161 $ cd $WORKDIR/aether-app-configs/infrastructure/coredns
162 $ mkdir overlays/prd-ace-test
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700163 $ vi overlays/prd-ace-test/values.yaml
164 # SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700165
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700166 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 Moond12f32b2021-07-30 12:55:00 -0700203
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700204
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700205Next, update ``fleet.yaml`` under ``infrastructure/coredns`` so that Fleet can use the custom configuration
206you just created when deploying UE-DNS to the cluster.
207
208.. code-block:: yaml
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700209
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 Moon2b2bf9a2021-08-01 05:29:48 -0700222Submit your changes.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700223
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
233Assign Fleet workspace
Zack Williams1ae109e2021-07-27 11:17:04 -0700234""""""""""""""""""""""
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700235
Zack Williams1ae109e2021-07-27 11:17:04 -0700236By default, all new clusters are assigned to a default Fleet workspace called **fleet-default**.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700237To make a cluster part of Aether and have the applications defined in aether-app-configs deployed,
238you must assign the cluster to either **aether-stable** or **aether-alpha** workspace.
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700239For clusters expecting minimal downtime, assign to **aether-stable**.
240For clusters for development or previewing upcoming release, assign to **aether-alpha**.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700241
Hyunsun Moon35868bc2021-08-11 15:01:13 -0700242Workspace assignment can be done from Fleet dashboard.
Zack Williams1ae109e2021-07-27 11:17:04 -0700243
Hyunsun Moon35868bc2021-08-11 15:01:13 -0700244To access Fleet dashboard, log in to `Rancher <https://rancher.aetherproject.org>`_ as
245``admin`` or ``onfadmin`` user, go to the **Cluster Explorer**,
246and click **Cluster Explorer > Continuous Delivery** in the top left dropdown menu.
247Now, perform the following steps to assign the new cluster to one of the Aether workspaces.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700248
249.. image:: images/fleet-move-workspace.png
250
Hyunsun Moon35868bc2021-08-11 15:01:13 -07002511) Click the second dropdown menu from the left at the top and switch the current workspace
252 to **fleet-default**.
2532) Click **Clusters** on the left menu.
2543) Select the cluster.
2554) Click **Assign to...** button and choose **aether-stable** or **aether-alpha**
256 in from the popup menu.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700257
Hyunsun Moon35868bc2021-08-11 15:01:13 -0700258To verify, switch the current workspace to the workspace the cluster is assigned to,
259click **Clusters** in the left menu, and check if the cluster exists.
260Wait for the system application deployment to complete and the cluster state
261to become **Active**.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700262
263.. attention::
264
Hyunsun Moon35868bc2021-08-11 15:01:13 -0700265 Ignore BESS UPF failure at this point if BESS UPF is enabled.