blob: 74f24dab627919aef22e22b711645b48a2954d55 [file] [log] [blame]
Eric Debeau993b77b2020-08-19 15:30:00 +02001.. This work is licensed under a Creative Commons Attribution 4.0
2.. International License.
Roger Maitland953b5f12018-03-22 15:24:04 -04003.. http://creativecommons.org/licenses/by/4.0
Eric Debeau993b77b2020-08-19 15:30:00 +02004.. Copyright 2018-2020 Amdocs, Bell Canada, Orange, Samsung
Jessica Wagantallafb1ead2020-04-09 12:39:10 -07005.. _oom_user_guide:
Roger Maitland953b5f12018-03-22 15:24:04 -04006
7.. Links
8.. _Curated applications for Kubernetes: https://github.com/kubernetes/charts
9.. _Services: https://kubernetes.io/docs/concepts/services-networking/service/
10.. _ReplicaSet: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
11.. _StatefulSet: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
12.. _Helm Documentation: https://docs.helm.sh/helm/
13.. _Helm: https://docs.helm.sh/
14.. _Kubernetes: https://Kubernetes.io/
Roger Maitlandda221582018-05-10 13:43:58 -040015.. _Kubernetes LoadBalancer: https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer
Roger Maitland953b5f12018-03-22 15:24:04 -040016.. _user-guide-label:
17
18OOM User Guide
19##############
20
21The ONAP Operations Manager (OOM) provide the ability to manage the entire
22life-cycle of an ONAP installation, from the initial deployment to final
23decommissioning. This guide provides instructions for users of ONAP to
24use the Kubernetes_/Helm_ system as a complete ONAP management system.
25
26This guide provides many examples of Helm command line operations. For a
27complete description of these commands please refer to the `Helm
28Documentation`_.
29
30.. figure:: oomLogoV2-medium.png
31 :align: right
32
33The following sections describe the life-cycle operations:
34
35- Deploy_ - with built-in component dependency management
36- Configure_ - unified configuration across all ONAP components
37- Monitor_ - real-time health monitoring feeding to a Consul UI and Kubernetes
38- Heal_- failed ONAP containers are recreated automatically
39- Scale_ - cluster ONAP services to enable seamless scaling
Eric Debeau993b77b2020-08-19 15:30:00 +020040- Upgrade_ - change-out containers or configuration with little or no service
41 impact
Roger Maitland953b5f12018-03-22 15:24:04 -040042- Delete_ - cleanup individual containers or entire deployments
43
44.. figure:: oomLogoV2-Deploy.png
45 :align: right
46
47Deploy
48======
49
50The OOM team with assistance from the ONAP project teams, have built a
51comprehensive set of Helm charts, yaml files very similar to TOSCA files, that
52describe the composition of each of the ONAP components and the relationship
53within and between components. Using this model Helm is able to deploy all of
Roger Maitlandbb8adda2018-04-05 16:18:11 -040054ONAP with a few simple commands.
55
56Pre-requisites
57--------------
Sylvain Desbureaux983c7552019-01-28 13:59:43 +010058Your environment must have both the Kubernetes `kubectl` and Helm setup as a
59one time activity.
Roger Maitlandbb8adda2018-04-05 16:18:11 -040060
61Install Kubectl
62~~~~~~~~~~~~~~~
Sylvain Desbureaux983c7552019-01-28 13:59:43 +010063Enter the following to install kubectl (on Ubuntu, there are slight differences
64on other O/Ss), the Kubernetes command line interface used to manage a
65Kubernetes cluster::
Roger Maitlandbb8adda2018-04-05 16:18:11 -040066
Michael O'Brien42d87d02018-04-18 17:17:54 -040067 > curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl
Roger Maitlandbb8adda2018-04-05 16:18:11 -040068 > chmod +x ./kubectl
69 > sudo mv ./kubectl /usr/local/bin/kubectl
70 > mkdir ~/.kube
71
Sylvain Desbureaux983c7552019-01-28 13:59:43 +010072Paste kubectl config from Rancher (see the :ref:`cloud-setup-guide-label` for
73alternative Kubernetes environment setups) into the `~/.kube/config` file.
Roger Maitlandbb8adda2018-04-05 16:18:11 -040074
75Verify that the Kubernetes config is correct::
76
77 > kubectl get pods --all-namespaces
78
79At this point you should see six Kubernetes pods running.
80
81Install Helm
82~~~~~~~~~~~~
Sylvain Desbureaux983c7552019-01-28 13:59:43 +010083Helm is used by OOM for package and configuration management. To install Helm,
84enter the following::
Roger Maitlandbb8adda2018-04-05 16:18:11 -040085
Michael O'Brien633217a2018-08-15 14:10:43 -040086 > wget http://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
87 > tar -zxvf helm-v2.9.1-linux-amd64.tar.gz
Roger Maitlandbb8adda2018-04-05 16:18:11 -040088 > sudo mv linux-amd64/helm /usr/local/bin/helm
89
90Verify the Helm version with::
91
92 > helm version
93
94Install the Helm Tiller application and initialize with::
95
96 > helm init
97
98Install the Helm Repo
99---------------------
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100100Once kubectl and Helm are setup, one needs to setup a local Helm server to
101server up the ONAP charts::
Roger Maitland953b5f12018-03-22 15:24:04 -0400102
103 > helm install osn/onap
104
105.. note::
106 The osn repo is not currently available so creation of a local repository is
107 required.
108
109Helm is able to use charts served up from a repository and comes setup with a
110default CNCF provided `Curated applications for Kubernetes`_ repository called
111stable which should be removed to avoid confusion::
112
113 > helm repo remove stable
114
115.. To setup the Open Source Networking Nexus repository for helm enter::
116.. > helm repo add osn 'https://nexus3.onap.org:10001/helm/helm-repo-in-nexus/master/'
117
118To prepare your system for an installation of ONAP, you'll need to::
119
Sylvain Desbureaux34a250b2020-06-08 15:02:11 +0200120 > git clone -b frankfurt --recurse-submodules -j2 http://gerrit.onap.org/r/oom
Roger Maitlandbb8adda2018-04-05 16:18:11 -0400121 > cd oom/kubernetes
122
Roger Maitland953b5f12018-03-22 15:24:04 -0400123
Roger Maitland953b5f12018-03-22 15:24:04 -0400124To setup a local Helm server to server up the ONAP charts::
125
Roger Maitlandbb8adda2018-04-05 16:18:11 -0400126 > helm init
Roger Maitland953b5f12018-03-22 15:24:04 -0400127 > helm serve &
128
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100129Note the port number that is listed and use it in the Helm repo add as
130follows::
Roger Maitland953b5f12018-03-22 15:24:04 -0400131
132 > helm repo add local http://127.0.0.1:8879
133
134To get a list of all of the available Helm chart repositories::
135
136 > helm repo list
137 NAME URL
138 local http://127.0.0.1:8879
139
Roger Maitland9e5067c2018-03-27 10:57:08 -0400140Then build your local Helm repository::
141
Jakub Latusekdb52a6d2020-10-15 15:02:47 +0200142 > make SKIP_LINT=TRUE [HELM_BIN=<HELM_PATH>] all
143
144`HELM_BIN`
145 Sets the helm binary to be used. The default value use helm from PATH. Allow the user to have
146 multiple version of helm in operating system and choose which one to use.
Roger Maitland9e5067c2018-03-27 10:57:08 -0400147
Roger Maitland953b5f12018-03-22 15:24:04 -0400148The Helm search command reads through all of the repositories configured on the
149system, and looks for matches::
150
151 > helm search -l
152 NAME VERSION DESCRIPTION
153 local/appc 2.0.0 Application Controller
154 local/clamp 2.0.0 ONAP Clamp
155 local/common 2.0.0 Common templates for inclusion in other charts
156 local/onap 2.0.0 Open Network Automation Platform (ONAP)
157 local/robot 2.0.0 A helm Chart for kubernetes-ONAP Robot
158 local/so 2.0.0 ONAP Service Orchestrator
159
160In any case, setup of the Helm repository is a one time activity.
161
Pawel Wieczorek1d4b96f2019-01-23 16:46:56 +0100162Next, install Helm Plugins required to deploy the ONAP Casablanca release::
163
164 > cp -R helm/plugins/ ~/.helm
165
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100166Once the repo is setup, installation of ONAP can be done with a single
167command::
Roger Maitland953b5f12018-03-22 15:24:04 -0400168
Pawel Wieczorek1d4b96f2019-01-23 16:46:56 +0100169 > helm deploy development local/onap --namespace onap
Roger Maitland953b5f12018-03-22 15:24:04 -0400170
171This will install ONAP from a local repository in a 'development' Helm release.
172As described below, to override the default configuration values provided by
173OOM, an environment file can be provided on the command line as follows::
174
Pawel Wieczorek1d4b96f2019-01-23 16:46:56 +0100175 > helm deploy development local/onap --namespace onap -f overrides.yaml
Roger Maitland953b5f12018-03-22 15:24:04 -0400176
177To get a summary of the status of all of the pods (containers) running in your
178deployment::
179
180 > kubectl get pods --all-namespaces -o=wide
181
182.. note::
183 The Kubernetes namespace concept allows for multiple instances of a component
184 (such as all of ONAP) to co-exist with other components in the same
185 Kubernetes cluster by isolating them entirely. Namespaces share only the
186 hosts that form the cluster thus providing isolation between production and
187 development systems as an example. The OOM deployment of ONAP in Beijing is
188 now done within a single Kubernetes namespace where in Amsterdam a namespace
189 was created for each of the ONAP components.
190
191.. note::
Roger Maitlandd96413f2018-04-09 10:06:07 -0400192 The Helm `--name` option refers to a release name and not a Kubernetes namespace.
Roger Maitland953b5f12018-03-22 15:24:04 -0400193
194
195To install a specific version of a single ONAP component (`so` in this example)
Pawel Wieczorek1d4b96f2019-01-23 16:46:56 +0100196with the given release name enter::
Roger Maitland953b5f12018-03-22 15:24:04 -0400197
Pawel Wieczorek1d4b96f2019-01-23 16:46:56 +0100198 > helm deploy so onap/so --version 3.0.1
Roger Maitland953b5f12018-03-22 15:24:04 -0400199
200To display details of a specific resource or group of resources type::
201
202 > kubectl describe pod so-1071802958-6twbl
203
204where the pod identifier refers to the auto-generated pod identifier.
205
206.. figure:: oomLogoV2-Configure.png
207 :align: right
208
209Configure
210=========
211
212Each project within ONAP has its own configuration data generally consisting
213of: environment variables, configuration files, and database initial values.
214Many technologies are used across the projects resulting in significant
215operational complexity and an inability to apply global parameters across the
216entire ONAP deployment. OOM solves this problem by introducing a common
217configuration technology, Helm charts, that provide a hierarchical
Gildas Lanilis64d17ae2018-05-18 16:58:05 -0700218configuration with the ability to override values with higher
Roger Maitland953b5f12018-03-22 15:24:04 -0400219level charts or command line options.
220
221The structure of the configuration of ONAP is shown in the following diagram.
222Note that key/value pairs of a parent will always take precedence over those
223of a child. Also note that values set on the command line have the highest
224precedence of all.
225
226.. graphviz::
227
228 digraph config {
229 {
230 node [shape=folder]
231 oValues [label="values.yaml"]
232 demo [label="onap-demo.yaml"]
233 prod [label="onap-production.yaml"]
234 oReq [label="requirements.yaml"]
235 soValues [label="values.yaml"]
236 soReq [label="requirements.yaml"]
237 mdValues [label="values.yaml"]
238 }
239 {
240 oResources [label="resources"]
241 }
242 onap -> oResources
243 onap -> oValues
244 oResources -> environments
245 oResources -> oReq
246 oReq -> so
247 environments -> demo
248 environments -> prod
249 so -> soValues
250 so -> soReq
251 so -> charts
252 charts -> mariadb
253 mariadb -> mdValues
254
255 }
256
257The top level onap/values.yaml file contains the values required to be set
258before deploying ONAP. Here is the contents of this file:
259
Pawel Wieczoreka1903d62019-11-14 14:19:59 +0100260.. include:: ../kubernetes/onap/values.yaml
Roger Maitland953b5f12018-03-22 15:24:04 -0400261 :code: yaml
262
263One may wish to create a value file that is specific to a given deployment such
264that it can be differentiated from other deployments. For example, a
265onap-development.yaml file may create a minimal environment for development
266while onap-production.yaml might describe a production deployment that operates
267independently of the developer version.
268
269For example, if the production OpenStack instance was different from a
270developer's instance, the onap-production.yaml file may contain a different
271value for the vnfDeployment/openstack/oam_network_cidr key as shown below.
272
273.. code-block:: yaml
274
275 nsPrefix: onap
276 nodePortPrefix: 302
277 apps: consul msb mso message-router sdnc vid robot portal policy appc aai
278 sdc dcaegen2 log cli multicloud clamp vnfsdk aaf kube2msb
279 dataRootDir: /dockerdata-nfs
280
281 # docker repositories
282 repository:
283 onap: nexus3.onap.org:10001
284 oom: oomk8s
285 aai: aaionap
286 filebeat: docker.elastic.co
287
288 image:
289 pullPolicy: Never
290
291 # vnf deployment environment
292 vnfDeployment:
293 openstack:
294 ubuntu_14_image: "Ubuntu_14.04.5_LTS"
295 public_net_id: "e8f51956-00dd-4425-af36-045716781ffc"
296 oam_network_id: "d4769dfb-c9e4-4f72-b3d6-1d18f4ac4ee6"
297 oam_subnet_id: "191f7580-acf6-4c2b-8ec0-ba7d99b3bc4e"
298 oam_network_cidr: "192.168.30.0/24"
299 <...>
300
301
302To deploy ONAP with this environment file, enter::
303
Sylvain Desbureaux5e19e242020-03-02 14:41:48 +0100304 > helm deploy local/onap -n onap -f environments/onap-production.yaml
Roger Maitland953b5f12018-03-22 15:24:04 -0400305
306.. include:: environments_onap_demo.yaml
307 :code: yaml
308
309When deploying all of ONAP a requirements.yaml file control which and what
310version of the ONAP components are included. Here is an excerpt of this
311file:
312
313.. code-block:: yaml
314
315 # Referencing a named repo called 'local'.
316 # Can add this repo by running commands like:
317 # > helm serve
318 # > helm repo add local http://127.0.0.1:8879
319 dependencies:
320 <...>
321 - name: so
322 version: ~2.0.0
323 repository: '@local'
324 condition: so.enabled
325 <...>
326
327The ~ operator in the `so` version value indicates that the latest "2.X.X"
328version of `so` shall be used thus allowing the chart to allow for minor
329upgrades that don't impact the so API; hence, version 2.0.1 will be installed
330in this case.
331
332The onap/resources/environment/onap-dev.yaml (see the excerpt below) enables
333for fine grained control on what components are included as part of this
334deployment. By changing this `so` line to `enabled: false` the `so` component
335will not be deployed. If this change is part of an upgrade the existing `so`
336component will be shut down. Other `so` parameters and even `so` child values
337can be modified, for example the `so`'s `liveness` probe could be disabled
338(which is not recommended as this change would disable auto-healing of `so`).
339
340.. code-block:: yaml
341
342 #################################################################
343 # Global configuration overrides.
344 #
345 # These overrides will affect all helm charts (ie. applications)
346 # that are listed below and are 'enabled'.
347 #################################################################
348 global:
349 <...>
350
351 #################################################################
352 # Enable/disable and configure helm charts (ie. applications)
353 # to customize the ONAP deployment.
354 #################################################################
355 aaf:
356 enabled: false
357 <...>
358 so: # Service Orchestrator
359 enabled: true
360
361 replicaCount: 1
362
363 liveness:
364 # necessary to disable liveness probe when setting breakpoints
365 # in debugger so K8s doesn't restart unresponsive container
366 enabled: true
367
368 <...>
369
Roger Maitlandda221582018-05-10 13:43:58 -0400370Accessing the ONAP Portal using OOM and a Kubernetes Cluster
371------------------------------------------------------------
372
373The ONAP deployment created by OOM operates in a private IP network that isn't
Eric Debeau993b77b2020-08-19 15:30:00 +0200374publicly accessible (i.e. OpenStack VMs with private internal network) which
Roger Maitlandda221582018-05-10 13:43:58 -0400375blocks access to the ONAP Portal. To enable direct access to this Portal from a
376user's own environment (a laptop etc.) the portal application's port 8989 is
377exposed through a `Kubernetes LoadBalancer`_ object.
378
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100379Typically, to be able to access the Kubernetes nodes publicly a public address
Eric Debeau993b77b2020-08-19 15:30:00 +0200380is assigned. In OpenStack this is a floating IP address.
Roger Maitlandda221582018-05-10 13:43:58 -0400381
382When the `portal-app` chart is deployed a Kubernetes service is created that
383instantiates a load balancer. The LB chooses the private interface of one of
384the nodes as in the example below (10.0.0.4 is private to the K8s cluster only).
385Then to be able to access the portal on port 8989 from outside the K8s &
Eric Debeau993b77b2020-08-19 15:30:00 +0200386OpenStack environment, the user needs to assign/get the floating IP address that
Roger Maitlandda221582018-05-10 13:43:58 -0400387corresponds to the private IP as follows::
388
389 > kubectl -n onap get services|grep "portal-app"
390 portal-app LoadBalancer 10.43.142.201 10.0.0.4 8989:30215/TCP,8006:30213/TCP,8010:30214/TCP 1d app=portal-app,release=dev
391
392
393In this example, use the 10.0.0.4 private address as a key find the
394corresponding public address which in this example is 10.12.6.155. If you're
Eric Debeau993b77b2020-08-19 15:30:00 +0200395using OpenStack you'll do the lookup with the horizon GUI or the OpenStack CLI
Roger Maitlandda221582018-05-10 13:43:58 -0400396for your tenant (openstack server list). That IP is then used in your
397`/etc/hosts` to map the fixed DNS aliases required by the ONAP Portal as shown
398below::
399
400 10.12.6.155 portal.api.simpledemo.onap.org
401 10.12.6.155 vid.api.simpledemo.onap.org
402 10.12.6.155 sdc.api.fe.simpledemo.onap.org
andreasgeissler4a618ba2018-11-30 14:20:46 +0000403 10.12.6.155 sdc.workflow.plugin.simpledemo.onap.org
404 10.12.6.155 sdc.dcae.plugin.simpledemo.onap.org
Roger Maitlandda221582018-05-10 13:43:58 -0400405 10.12.6.155 portal-sdk.simpledemo.onap.org
406 10.12.6.155 policy.api.simpledemo.onap.org
407 10.12.6.155 aai.api.sparky.simpledemo.onap.org
408 10.12.6.155 cli.api.simpledemo.onap.org
409 10.12.6.155 msb.api.discovery.simpledemo.onap.org
andreasgeissler4a618ba2018-11-30 14:20:46 +0000410 10.12.6.155 msb.api.simpledemo.onap.org
411 10.12.6.155 clamp.api.simpledemo.onap.org
412 10.12.6.155 so.api.simpledemo.onap.org
Sylvain Desbureaux1037d752020-04-20 14:17:16 +0200413 10.12.6.155 sdc.workflow.plugin.simpledemo.onap.org
Roger Maitlandda221582018-05-10 13:43:58 -0400414
415Ensure you've disabled any proxy settings the browser you are using to access
andreasgeissler4a618ba2018-11-30 14:20:46 +0000416the portal and then simply access now the new ssl-encrypted URL:
417https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/login.htm
Roger Maitlandda221582018-05-10 13:43:58 -0400418
andreasgeissler4a618ba2018-11-30 14:20:46 +0000419.. note::
420 Using the HTTPS based Portal URL the Browser needs to be configured to accept
421 unsecure credentials.
422 Additionally when opening an Application inside the Portal, the Browser
423 might block the content, which requires to disable the blocking and reloading
424 of the page
425
426.. note::
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100427 Besides the ONAP Portal the Components can deliver additional user interfaces,
andreasgeissler4a618ba2018-11-30 14:20:46 +0000428 please check the Component specific documentation.
Roger Maitlandda221582018-05-10 13:43:58 -0400429
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100430.. note::
Roger Maitlandda221582018-05-10 13:43:58 -0400431
Hector Anapan-Lavalle55547da2018-07-26 13:33:17 -0400432 | Alternatives Considered:
433
434 - Kubernetes port forwarding was considered but discarded as it would require
435 the end user to run a script that opens up port forwarding tunnels to each of
436 the pods that provides a portal application widget.
437
438 - Reverting to a VNC server similar to what was deployed in the Amsterdam
439 release was also considered but there were many issues with resolution, lack
440 of volume mount, /etc/hosts dynamic update, file upload that were a tall order
441 to solve in time for the Beijing release.
442
443 Observations:
444
445 - If you are not using floating IPs in your Kubernetes deployment and directly attaching
446 a public IP address (i.e. by using your public provider network) to your K8S Node
447 VMs' network interface, then the output of 'kubectl -n onap get services | grep "portal-app"'
448 will show your public IP instead of the private network's IP. Therefore,
449 you can grab this public IP directly (as compared to trying to find the floating
450 IP first) and map this IP in /etc/hosts.
Roger Maitlandda221582018-05-10 13:43:58 -0400451
Roger Maitland953b5f12018-03-22 15:24:04 -0400452.. figure:: oomLogoV2-Monitor.png
453 :align: right
454
455Monitor
456=======
457
458All highly available systems include at least one facility to monitor the
459health of components within the system. Such health monitors are often used as
Eric Debeau993b77b2020-08-19 15:30:00 +0200460inputs to distributed coordination systems (such as etcd, Zookeeper, or Consul)
461and monitoring systems (such as Nagios or Zabbix). OOM provides two mechanisms
Roger Maitland953b5f12018-03-22 15:24:04 -0400462to monitor the real-time health of an ONAP deployment:
463
464- a Consul GUI for a human operator or downstream monitoring systems and
465 Kubernetes liveness probes that enable automatic healing of failed
466 containers, and
467- a set of liveness probes which feed into the Kubernetes manager which
468 are described in the Heal section.
469
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100470Within ONAP, Consul is the monitoring system of choice and deployed by OOM in
471two parts:
Roger Maitland953b5f12018-03-22 15:24:04 -0400472
473- a three-way, centralized Consul server cluster is deployed as a highly
Gildas Lanilis64d17ae2018-05-18 16:58:05 -0700474 available monitor of all of the ONAP components, and
Roger Maitland953b5f12018-03-22 15:24:04 -0400475- a number of Consul agents.
476
477The Consul server provides a user interface that allows a user to graphically
478view the current health status of all of the ONAP components for which agents
479have been created - a sample from the ONAP Integration labs follows:
480
481.. figure:: consulHealth.png
482 :align: center
483
484To see the real-time health of a deployment go to: http://<kubernetes IP>:30270/ui/
485where a GUI much like the following will be found:
486
487
488.. figure:: oomLogoV2-Heal.png
489 :align: right
490
491Heal
492====
493
494The ONAP deployment is defined by Helm charts as mentioned earlier. These Helm
495charts are also used to implement automatic recoverability of ONAP components
496when individual components fail. Once ONAP is deployed, a "liveness" probe
497starts checking the health of the components after a specified startup time.
498
499Should a liveness probe indicate a failed container it will be terminated and a
500replacement will be started in its place - containers are ephemeral. Should the
501deployment specification indicate that there are one or more dependencies to
502this container or component (for example a dependency on a database) the
503dependency will be satisfied before the replacement container/component is
504started. This mechanism ensures that, after a failure, all of the ONAP
505components restart successfully.
506
507To test healing, the following command can be used to delete a pod::
508
509 > kubectl delete pod [pod name] -n [pod namespace]
510
511One could then use the following command to monitor the pods and observe the
512pod being terminated and the service being automatically healed with the
513creation of a replacement pod::
514
515 > kubectl get pods --all-namespaces -o=wide
516
517.. figure:: oomLogoV2-Scale.png
518 :align: right
519
520Scale
521=====
522
523Many of the ONAP components are horizontally scalable which allows them to
524adapt to expected offered load. During the Beijing release scaling is static,
525that is during deployment or upgrade a cluster size is defined and this cluster
526will be maintained even in the presence of faults. The parameter that controls
527the cluster size of a given component is found in the values.yaml file for that
528component. Here is an excerpt that shows this parameter:
529
530.. code-block:: yaml
531
532 # default number of instances
533 replicaCount: 1
534
535In order to change the size of a cluster, an operator could use a helm upgrade
536(described in detail in the next section) as follows::
537
538 > helm upgrade --set replicaCount=3 onap/so/mariadb
539
540The ONAP components use Kubernetes provided facilities to build clustered,
541highly available systems including: Services_ with load-balancers, ReplicaSet_,
542and StatefulSet_. Some of the open-source projects used by the ONAP components
543directly support clustered configurations, for example ODL and MariaDB Galera.
544
545The Kubernetes Services_ abstraction to provide a consistent access point for
546each of the ONAP components, independent of the pod or container architecture
547of that component. For example, SDN-C uses OpenDaylight clustering with a
548default cluster size of three but uses a Kubernetes service to and change the
549number of pods in this abstract this cluster from the other ONAP components
550such that the cluster could change size and this change is isolated from the
551other ONAP components by the load-balancer implemented in the ODL service
552abstraction.
553
554A ReplicaSet_ is a construct that is used to describe the desired state of the
555cluster. For example 'replicas: 3' indicates to Kubernetes that a cluster of 3
556instances is the desired state. Should one of the members of the cluster fail,
557a new member will be automatically started to replace it.
558
559Some of the ONAP components many need a more deterministic deployment; for
560example to enable intra-cluster communication. For these applications the
561component can be deployed as a Kubernetes StatefulSet_ which will maintain a
562persistent identifier for the pods and thus a stable network id for the pods.
563For example: the pod names might be web-0, web-1, web-{N-1} for N 'web' pods
564with corresponding DNS entries such that intra service communication is simple
565even if the pods are physically distributed across multiple nodes. An example
566of how these capabilities can be used is described in the Running Consul on
567Kubernetes tutorial.
568
569.. figure:: oomLogoV2-Upgrade.png
570 :align: right
571
572Upgrade
573=======
574
575Helm has built-in capabilities to enable the upgrade of pods without causing a
576loss of the service being provided by that pod or pods (if configured as a
577cluster). As described in the OOM Developer's Guide, ONAP components provide
578an abstracted 'service' end point with the pods or containers providing this
579service hidden from other ONAP components by a load balancer. This capability
580is used during upgrades to allow a pod with a new image to be added to the
581service before removing the pod with the old image. This 'make before break'
582capability ensures minimal downtime.
583
584Prior to doing an upgrade, determine of the status of the deployed charts::
585
586 > helm list
587 NAME REVISION UPDATED STATUS CHART NAMESPACE
588 so 1 Mon Feb 5 10:05:22 2018 DEPLOYED so-2.0.1 default
589
590When upgrading a cluster a parameter controls the minimum size of the cluster
591during the upgrade while another parameter controls the maximum number of nodes
592in the cluster. For example, SNDC configured as a 3-way ODL cluster might
593require that during the upgrade no fewer than 2 pods are available at all times
594to provide service while no more than 5 pods are ever deployed across the two
595versions at any one time to avoid depleting the cluster of resources. In this
596scenario, the SDNC cluster would start with 3 old pods then Kubernetes may add
597a new pod (3 old, 1 new), delete one old (2 old, 1 new), add two new pods (2
598old, 3 new) and finally delete the 2 old pods (3 new). During this sequence
599the constraints of the minimum of two pods and maximum of five would be
600maintained while providing service the whole time.
601
602Initiation of an upgrade is triggered by changes in the Helm charts. For
603example, if the image specified for one of the pods in the SDNC deployment
604specification were to change (i.e. point to a new Docker image in the nexus3
605repository - commonly through the change of a deployment variable), the
606sequence of events described in the previous paragraph would be initiated.
607
608For example, to upgrade a container by changing configuration, specifically an
609environment value::
610
Sylvain Desbureaux5e19e242020-03-02 14:41:48 +0100611 > helm deploy onap onap/so --version 2.0.1 --set enableDebug=true
Roger Maitland953b5f12018-03-22 15:24:04 -0400612
613Issuing this command will result in the appropriate container being stopped by
614Kubernetes and replaced with a new container with the new environment value.
615
616To upgrade a component to a new version with a new configuration file enter::
617
Eric Debeau993b77b2020-08-19 15:30:00 +0200618 > helm deploy onap onap/so --version 2.0.2 -f environments/demo.yaml
Roger Maitland953b5f12018-03-22 15:24:04 -0400619
620To fetch release history enter::
621
622 > helm history so
623 REVISION UPDATED STATUS CHART DESCRIPTION
624 1 Mon Feb 5 10:05:22 2018 SUPERSEDED so-2.0.1 Install complete
625 2 Mon Feb 5 10:10:55 2018 DEPLOYED so-2.0.2 Upgrade complete
626
627Unfortunately, not all upgrades are successful. In recognition of this the
628lineup of pods within an ONAP deployment is tagged such that an administrator
629may force the ONAP deployment back to the previously tagged configuration or to
630a specific configuration, say to jump back two steps if an incompatibility
631between two ONAP components is discovered after the two individual upgrades
632succeeded.
633
634This rollback functionality gives the administrator confidence that in the
635unfortunate circumstance of a failed upgrade the system can be rapidly brought
636back to a known good state. This process of rolling upgrades while under
637service is illustrated in this short YouTube video showing a Zero Downtime
638Upgrade of a web application while under a 10 million transaction per second
639load.
640
641For example, to roll-back back to previous system revision enter::
642
643 > helm rollback so 1
644
645 > helm history so
646 REVISION UPDATED STATUS CHART DESCRIPTION
647 1 Mon Feb 5 10:05:22 2018 SUPERSEDED so-2.0.1 Install complete
648 2 Mon Feb 5 10:10:55 2018 SUPERSEDED so-2.0.2 Upgrade complete
649 3 Mon Feb 5 10:14:32 2018 DEPLOYED so-2.0.1 Rollback to 1
650
651.. note::
652
653 The description field can be overridden to document actions taken or include
654 tracking numbers.
655
656Many of the ONAP components contain their own databases which are used to
657record configuration or state information. The schemas of these databases may
658change from version to version in such a way that data stored within the
659database needs to be migrated between versions. If such a migration script is
660available it can be invoked during the upgrade (or rollback) by Container
661Lifecycle Hooks. Two such hooks are available, PostStart and PreStop, which
662containers can access by registering a handler against one or both. Note that
663it is the responsibility of the ONAP component owners to implement the hook
664handlers - which could be a shell script or a call to a specific container HTTP
665endpoint - following the guidelines listed on the Kubernetes site. Lifecycle
666hooks are not restricted to database migration or even upgrades but can be used
667anywhere specific operations need to be taken during lifecycle operations.
668
669OOM uses Helm K8S package manager to deploy ONAP components. Each component is
670arranged in a packaging format called a chart - a collection of files that
671describe a set of k8s resources. Helm allows for rolling upgrades of the ONAP
672component deployed. To upgrade a component Helm release you will need an
673updated Helm chart. The chart might have modified, deleted or added values,
674deployment yamls, and more. To get the release name use::
675
676 > helm ls
677
678To easily upgrade the release use::
679
680 > helm upgrade [RELEASE] [CHART]
681
682To roll back to a previous release version use::
683
684 > helm rollback [flags] [RELEASE] [REVISION]
685
686For example, to upgrade the onap-so helm release to the latest SO container
687release v1.1.2:
688
689- Edit so values.yaml which is part of the chart
690- Change "so: nexus3.onap.org:10001/openecomp/so:v1.1.1" to
691 "so: nexus3.onap.org:10001/openecomp/so:v1.1.2"
692- From the chart location run::
693
694 > helm upgrade onap-so
695
696The previous so pod will be terminated and a new so pod with an updated so
697container will be created.
698
699.. figure:: oomLogoV2-Delete.png
700 :align: right
701
702Delete
703======
704
705Existing deployments can be partially or fully removed once they are no longer
706needed. To minimize errors it is recommended that before deleting components
707from a running deployment the operator perform a 'dry-run' to display exactly
708what will happen with a given command prior to actually deleting anything. For
709example::
710
Sylvain Desbureaux5e19e242020-03-02 14:41:48 +0100711 > helm undeploy onap --dry-run
Roger Maitland953b5f12018-03-22 15:24:04 -0400712
Sylvain Desbureaux5e19e242020-03-02 14:41:48 +0100713will display the outcome of deleting the 'onap' release from the
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100714deployment.
Roger Maitland953b5f12018-03-22 15:24:04 -0400715To completely delete a release and remove it from the internal store enter::
716
Sylvain Desbureaux5e19e242020-03-02 14:41:48 +0100717 > helm undeploy onap --purge
Roger Maitland953b5f12018-03-22 15:24:04 -0400718
719One can also remove individual components from a deployment by changing the
720ONAP configuration values. For example, to remove `so` from a running
721deployment enter::
722
Sylvain Desbureaux5e19e242020-03-02 14:41:48 +0100723 > helm undeploy onap-so --purge
Roger Maitland953b5f12018-03-22 15:24:04 -0400724
725will remove `so` as the configuration indicates it's no longer part of the
726deployment. This might be useful if a one wanted to replace just `so` by
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100727installing a custom version.