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