blob: bf49aee5d9f45df88c31475ab6f59af75ea59d50 [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
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
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**,
22to provide the cluster configurations to the CI/CD systems.
Hyunsun Moon049b5052021-07-30 12:41:03 -070023
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 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
Hyunsun Moon049b5052021-07-30 12:41:03 -070043 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 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 Moond12f32b2021-07-30 12:55:00 -070069Create a review request.
Zack Williams794532a2021-03-18 17:38:36 -070070
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070071.. code-block:: shell
72
Hyunsun Moona79c7422020-11-18 04:52:56 -080073 $ cd $WORKDIR/aether-pod-configs
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070074 $ git add .
Hyunsun Moona79c7422020-11-18 04:52:56 -080075 $ git commit -m "Add test ACE runtime configs"
Hyunsun Moon5ca6bfb2020-10-29 22:29:12 -070076 $ git review
Hyunsun Moond12f32b2021-07-30 12:55:00 -070077
78Once your review request is accepted and merged, Aether CI/CD system starts to deploy K8S.
79Wait until the cluster status changes to **Active** in `Rancher <https://rancher.aetherproject.org>`_.
80It normally takes 10 - 15 minutes depending on the speed of the container images
81download at the edge.
82
Hyunsun Moon35868bc2021-08-11 15:01:13 -070083It is also a good idea to check the system pod status after successful K8S deployment.
84To 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.
86Run 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 Moond12f32b2021-07-30 12:55:00 -070094System Application Deployment
95-----------------------------
96
97For the system application deployment, we will be using Rancher's built-in GitOps tool, **Fleet**.
98Fleet uses a git repository as a single source of truth to manage applications in the clusters.
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -070099For Aether, **aether-app-configs** is the repository where all Aether applications
100are defined.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700101
102Most of the Aether system applications do not require cluster specific configurations,
103except **rancher-monitoring** and **uedns**.
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700104For these applications, you will have to manually create custom configurations and
105commit them to aether-app-configs.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700106
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700107First, download ``aether-app-configs`` if you don't have it already in your development machine.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700108
109.. code-block:: shell
110
111 $ cd $WORKDIR
112 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-app-configs"
113
114Configure rancher-monitoring
115############################
116
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700117Open ``fleet.yaml`` under ``infrastructure/rancher-monitoring``, add a custom target
118with the new cluster name as a selector, and provide cluster specific Helm values and
119kustomize overlay directory path like below.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700120
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700121.. code-block:: yaml
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700122
123 $ cd $WORKDIR/aether-app-configs/infrastructure/rancher-monitoring
124 $ vi fleet.yaml
125 # add following block at the end
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700126 - name: ace-test
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700127 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
145Configure ue-dns
146################
147
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700148For UE-DNS, it is required to create a Helm values file for the new cluster.
149You'll need cluster domain and kube-dns ClusterIP. Both can be found in
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700150``aether-pod-configs/production/cluster_map.tfvars``.
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700151Be sure to replace ``[ ]`` in the example configuration below to the actual cluster values.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700152
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700153.. code-block:: yaml
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700154
155 $ cd $WORKDIR/aether-app-configs/infrastructure/coredns
156 $ mkdir overlays/prd-ace-test
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700157 $ vi overlays/prd-ace-test/values.yaml
158 # SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700159
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700160 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 Moond12f32b2021-07-30 12:55:00 -0700197
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700198
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700199Next, update ``fleet.yaml`` under ``infrastructure/coredns`` so that Fleet can use the custom configuration
200you just created when deploying UE-DNS to the cluster.
201
202.. code-block:: yaml
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700203
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 Moon2b2bf9a2021-08-01 05:29:48 -0700216Submit your changes.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700217
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
227Assign Fleet workspace
228######################
229
230By default, all new clusters are assgiend to a default Fleet workspace called **fleet-default**.
231To make a cluster part of Aether and have the applications defined in aether-app-configs deployed,
232you must assign the cluster to either **aether-stable** or **aether-alpha** workspace.
Hyunsun Moonb9c7dde2021-08-01 06:11:08 -0700233For clusters expecting minimal downtime, assign to **aether-stable**.
234For clusters for development or previewing upcoming release, assign to **aether-alpha**.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700235
Hyunsun Moon35868bc2021-08-11 15:01:13 -0700236Workspace assignment can be done from Fleet dashboard.
237To access Fleet dashboard, log in to `Rancher <https://rancher.aetherproject.org>`_ as
238``admin`` or ``onfadmin`` user, go to the **Cluster Explorer**,
239and click **Cluster Explorer > Continuous Delivery** in the top left dropdown menu.
240Now, perform the following steps to assign the new cluster to one of the Aether workspaces.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700241
242.. image:: images/fleet-move-workspace.png
243
Hyunsun Moon35868bc2021-08-11 15:01:13 -07002441) Click the second dropdown menu from the left at the top and switch the current workspace
245 to **fleet-default**.
2462) Click **Clusters** on the left menu.
2473) Select the cluster.
2484) Click **Assign to...** button and choose **aether-stable** or **aether-alpha**
249 in from the popup menu.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700250
Hyunsun Moon35868bc2021-08-11 15:01:13 -0700251To verify, switch the current workspace to the workspace the cluster is assigned to,
252click **Clusters** in the left menu, and check if the cluster exists.
253Wait for the system application deployment to complete and the cluster state
254to become **Active**.
Hyunsun Moond12f32b2021-07-30 12:55:00 -0700255
256.. attention::
257
Hyunsun Moon35868bc2021-08-11 15:01:13 -0700258 Ignore BESS UPF failure at this point if BESS UPF is enabled.