blob: 02f5c483b5cba7de74317bb8e800775dbb3c7e6e [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
Roger Maitland953b5f12018-03-22 15:24:04 -040016.. _user-guide-label:
17
Sylvain Desbureaux557628a2021-03-24 14:59:16 +010018OOM User Guide helm3 (experimental)
19###################################
Roger Maitland953b5f12018-03-22 15:24:04 -040020
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 Desbureaux557628a2021-03-24 14:59:16 +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
ramagp060a51c2020-10-29 04:24:16 +000067 > curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.15.11/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
ramagp060a51c2020-10-29 04:24:16 +000079At this point you should see Kubernetes pods running.
Roger Maitlandbb8adda2018-04-05 16:18:11 -040080
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
Sylvain Desbureaux557628a2021-03-24 14:59:16 +010086 > wget https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz
87 > tar -zxvf helm-v3.5.2-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
Roger Maitlandbb8adda2018-04-05 16:18:11 -040094Install the Helm Repo
95---------------------
Sylvain Desbureaux983c7552019-01-28 13:59:43 +010096Once kubectl and Helm are setup, one needs to setup a local Helm server to
97server up the ONAP charts::
Roger Maitland953b5f12018-03-22 15:24:04 -040098
99 > helm install osn/onap
100
101.. note::
102 The osn repo is not currently available so creation of a local repository is
103 required.
104
105Helm is able to use charts served up from a repository and comes setup with a
106default CNCF provided `Curated applications for Kubernetes`_ repository called
107stable which should be removed to avoid confusion::
108
109 > helm repo remove stable
110
111.. To setup the Open Source Networking Nexus repository for helm enter::
112.. > helm repo add osn 'https://nexus3.onap.org:10001/helm/helm-repo-in-nexus/master/'
113
114To prepare your system for an installation of ONAP, you'll need to::
115
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100116 > git clone -b guilin --recurse-submodules -j2 http://gerrit.onap.org/r/oom
Roger Maitlandbb8adda2018-04-05 16:18:11 -0400117 > cd oom/kubernetes
118
Roger Maitland953b5f12018-03-22 15:24:04 -0400119
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100120To install a local Helm server::
121
122 > curl -LO https://s3.amazonaws.com/chartmuseum/release/latest/bin/linux/amd64/chartmuseum
123 > chmod +x ./chartmuseum
124 > mv ./chartmuseum /usr/local/bin
125
Roger Maitland953b5f12018-03-22 15:24:04 -0400126To setup a local Helm server to server up the ONAP charts::
127
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100128 > mkdir -p ~/helm3-storage
129 > chartmuseum --storage local --storage-local-rootdir ~/helm3-storage -port 8879 &
Roger Maitland953b5f12018-03-22 15:24:04 -0400130
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100131Note the port number that is listed and use it in the Helm repo add as
132follows::
Roger Maitland953b5f12018-03-22 15:24:04 -0400133
134 > helm repo add local http://127.0.0.1:8879
135
136To get a list of all of the available Helm chart repositories::
137
138 > helm repo list
139 NAME URL
140 local http://127.0.0.1:8879
141
Roger Maitland9e5067c2018-03-27 10:57:08 -0400142Then build your local Helm repository::
143
Jakub Latusekdb52a6d2020-10-15 15:02:47 +0200144 > make SKIP_LINT=TRUE [HELM_BIN=<HELM_PATH>] all
145
146`HELM_BIN`
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100147 Sets the helm binary to be used. The default value use helm from PATH
Roger Maitland9e5067c2018-03-27 10:57:08 -0400148
Roger Maitland953b5f12018-03-22 15:24:04 -0400149The Helm search command reads through all of the repositories configured on the
150system, and looks for matches::
151
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100152 > helm search repo local
Roger Maitland953b5f12018-03-22 15:24:04 -0400153 NAME VERSION DESCRIPTION
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100154 local/appc 2.0.0 Application Controller
155 local/clamp 2.0.0 ONAP Clamp
156 local/common 2.0.0 Common templates for inclusion in other charts
157 local/onap 2.0.0 Open Network Automation Platform (ONAP)
158 local/robot 2.0.0 A helm Chart for kubernetes-ONAP Robot
159 local/so 2.0.0 ONAP Service Orchestrator
Roger Maitland953b5f12018-03-22 15:24:04 -0400160
161In any case, setup of the Helm repository is a one time activity.
162
ramagp060a51c2020-10-29 04:24:16 +0000163Next, install Helm Plugins required to deploy the ONAP release::
Pawel Wieczorek1d4b96f2019-01-23 16:46:56 +0100164
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100165 > cp -R ~/oom/kubernetes/helm/plugins/ ~/.local/share/helm/plugins
Pawel Wieczorek1d4b96f2019-01-23 16:46:56 +0100166
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100167Once the repo is setup, installation of ONAP can be done with a single
168command::
Roger Maitland953b5f12018-03-22 15:24:04 -0400169
ramagp060a51c2020-10-29 04:24:16 +0000170 > helm deploy development local/onap --namespace onap --set global.masterPassword=password
Roger Maitland953b5f12018-03-22 15:24:04 -0400171
172This will install ONAP from a local repository in a 'development' Helm release.
173As described below, to override the default configuration values provided by
174OOM, an environment file can be provided on the command line as follows::
175
ramagp060a51c2020-10-29 04:24:16 +0000176
177
178 > helm deploy development local/onap --namespace onap -f overrides.yaml --set global.masterPassword=password
179
180.. note::
181 Refer the Configure_ section on how to update overrides.yaml and values.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
ramagp060a51c2020-10-29 04:24:16 +0000186 > kubectl get pods --namespace onap -o=wide
Roger Maitland953b5f12018-03-22 15:24:04 -0400187
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
ramagp060a51c2020-10-29 04:24:16 +0000193 development systems as an example.
Roger Maitland953b5f12018-03-22 15:24:04 -0400194
195.. note::
Roger Maitlandd96413f2018-04-09 10:06:07 -0400196 The Helm `--name` option refers to a release name and not a Kubernetes namespace.
Roger Maitland953b5f12018-03-22 15:24:04 -0400197
198
199To install a specific version of a single ONAP component (`so` in this example)
Pawel Wieczorek1d4b96f2019-01-23 16:46:56 +0100200with the given release name enter::
Roger Maitland953b5f12018-03-22 15:24:04 -0400201
ramagp060a51c2020-10-29 04:24:16 +0000202 > helm deploy so onap/so --version 8.0.0 --set global.masterPassword=password --set global.flavor=unlimited --namespace onap
203
204.. note::
205 The dependent components should be installed for component being installed
206
Roger Maitland953b5f12018-03-22 15:24:04 -0400207
208To display details of a specific resource or group of resources type::
209
210 > kubectl describe pod so-1071802958-6twbl
211
212where the pod identifier refers to the auto-generated pod identifier.
213
214.. figure:: oomLogoV2-Configure.png
215 :align: right
216
217Configure
218=========
219
220Each project within ONAP has its own configuration data generally consisting
221of: environment variables, configuration files, and database initial values.
222Many technologies are used across the projects resulting in significant
223operational complexity and an inability to apply global parameters across the
224entire ONAP deployment. OOM solves this problem by introducing a common
225configuration technology, Helm charts, that provide a hierarchical
Gildas Lanilis64d17ae2018-05-18 16:58:05 -0700226configuration with the ability to override values with higher
Roger Maitland953b5f12018-03-22 15:24:04 -0400227level charts or command line options.
228
229The structure of the configuration of ONAP is shown in the following diagram.
230Note that key/value pairs of a parent will always take precedence over those
231of a child. Also note that values set on the command line have the highest
232precedence of all.
233
234.. graphviz::
235
236 digraph config {
237 {
238 node [shape=folder]
239 oValues [label="values.yaml"]
240 demo [label="onap-demo.yaml"]
241 prod [label="onap-production.yaml"]
242 oReq [label="requirements.yaml"]
243 soValues [label="values.yaml"]
244 soReq [label="requirements.yaml"]
245 mdValues [label="values.yaml"]
246 }
247 {
248 oResources [label="resources"]
249 }
250 onap -> oResources
251 onap -> oValues
252 oResources -> environments
253 oResources -> oReq
254 oReq -> so
255 environments -> demo
256 environments -> prod
257 so -> soValues
258 so -> soReq
259 so -> charts
260 charts -> mariadb
261 mariadb -> mdValues
262
263 }
264
265The top level onap/values.yaml file contains the values required to be set
266before deploying ONAP. Here is the contents of this file:
267
Pawel Wieczoreka1903d62019-11-14 14:19:59 +0100268.. include:: ../kubernetes/onap/values.yaml
Roger Maitland953b5f12018-03-22 15:24:04 -0400269 :code: yaml
270
271One may wish to create a value file that is specific to a given deployment such
272that it can be differentiated from other deployments. For example, a
273onap-development.yaml file may create a minimal environment for development
274while onap-production.yaml might describe a production deployment that operates
275independently of the developer version.
276
277For example, if the production OpenStack instance was different from a
278developer's instance, the onap-production.yaml file may contain a different
279value for the vnfDeployment/openstack/oam_network_cidr key as shown below.
280
281.. code-block:: yaml
282
283 nsPrefix: onap
284 nodePortPrefix: 302
285 apps: consul msb mso message-router sdnc vid robot portal policy appc aai
286 sdc dcaegen2 log cli multicloud clamp vnfsdk aaf kube2msb
287 dataRootDir: /dockerdata-nfs
288
289 # docker repositories
290 repository:
291 onap: nexus3.onap.org:10001
292 oom: oomk8s
293 aai: aaionap
294 filebeat: docker.elastic.co
295
296 image:
297 pullPolicy: Never
298
299 # vnf deployment environment
300 vnfDeployment:
301 openstack:
302 ubuntu_14_image: "Ubuntu_14.04.5_LTS"
303 public_net_id: "e8f51956-00dd-4425-af36-045716781ffc"
304 oam_network_id: "d4769dfb-c9e4-4f72-b3d6-1d18f4ac4ee6"
305 oam_subnet_id: "191f7580-acf6-4c2b-8ec0-ba7d99b3bc4e"
306 oam_network_cidr: "192.168.30.0/24"
307 <...>
308
309
310To deploy ONAP with this environment file, enter::
311
ramagp060a51c2020-10-29 04:24:16 +0000312 > helm deploy local/onap -n onap -f onap/resources/environments/onap-production.yaml --set global.masterPassword=password
Roger Maitland953b5f12018-03-22 15:24:04 -0400313
314.. include:: environments_onap_demo.yaml
315 :code: yaml
316
317When deploying all of ONAP a requirements.yaml file control which and what
318version of the ONAP components are included. Here is an excerpt of this
319file:
320
321.. code-block:: yaml
322
323 # Referencing a named repo called 'local'.
324 # Can add this repo by running commands like:
325 # > helm serve
326 # > helm repo add local http://127.0.0.1:8879
327 dependencies:
328 <...>
329 - name: so
ramagp060a51c2020-10-29 04:24:16 +0000330 version: ~8.0.0
Roger Maitland953b5f12018-03-22 15:24:04 -0400331 repository: '@local'
332 condition: so.enabled
333 <...>
334
ramagp060a51c2020-10-29 04:24:16 +0000335The ~ operator in the `so` version value indicates that the latest "8.X.X"
Roger Maitland953b5f12018-03-22 15:24:04 -0400336version of `so` shall be used thus allowing the chart to allow for minor
ramagp060a51c2020-10-29 04:24:16 +0000337upgrades that don't impact the so API; hence, version 8.0.1 will be installed
Roger Maitland953b5f12018-03-22 15:24:04 -0400338in this case.
339
ramagp060a51c2020-10-29 04:24:16 +0000340The onap/resources/environment/dev.yaml (see the excerpt below) enables
Roger Maitland953b5f12018-03-22 15:24:04 -0400341for fine grained control on what components are included as part of this
342deployment. By changing this `so` line to `enabled: false` the `so` component
343will not be deployed. If this change is part of an upgrade the existing `so`
344component will be shut down. Other `so` parameters and even `so` child values
345can be modified, for example the `so`'s `liveness` probe could be disabled
346(which is not recommended as this change would disable auto-healing of `so`).
347
348.. code-block:: yaml
349
350 #################################################################
351 # Global configuration overrides.
352 #
353 # These overrides will affect all helm charts (ie. applications)
354 # that are listed below and are 'enabled'.
355 #################################################################
356 global:
357 <...>
358
359 #################################################################
360 # Enable/disable and configure helm charts (ie. applications)
361 # to customize the ONAP deployment.
362 #################################################################
363 aaf:
364 enabled: false
365 <...>
366 so: # Service Orchestrator
367 enabled: true
368
369 replicaCount: 1
370
371 liveness:
372 # necessary to disable liveness probe when setting breakpoints
373 # in debugger so K8s doesn't restart unresponsive container
374 enabled: true
375
376 <...>
377
Roger Maitlandda221582018-05-10 13:43:58 -0400378Accessing the ONAP Portal using OOM and a Kubernetes Cluster
379------------------------------------------------------------
380
381The ONAP deployment created by OOM operates in a private IP network that isn't
Eric Debeau993b77b2020-08-19 15:30:00 +0200382publicly accessible (i.e. OpenStack VMs with private internal network) which
Roger Maitlandda221582018-05-10 13:43:58 -0400383blocks access to the ONAP Portal. To enable direct access to this Portal from a
384user's own environment (a laptop etc.) the portal application's port 8989 is
385exposed through a `Kubernetes LoadBalancer`_ object.
386
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100387Typically, to be able to access the Kubernetes nodes publicly a public address
Eric Debeau993b77b2020-08-19 15:30:00 +0200388is assigned. In OpenStack this is a floating IP address.
Roger Maitlandda221582018-05-10 13:43:58 -0400389
390When the `portal-app` chart is deployed a Kubernetes service is created that
391instantiates a load balancer. The LB chooses the private interface of one of
392the nodes as in the example below (10.0.0.4 is private to the K8s cluster only).
393Then to be able to access the portal on port 8989 from outside the K8s &
Eric Debeau993b77b2020-08-19 15:30:00 +0200394OpenStack environment, the user needs to assign/get the floating IP address that
Roger Maitlandda221582018-05-10 13:43:58 -0400395corresponds to the private IP as follows::
396
397 > kubectl -n onap get services|grep "portal-app"
398 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
399
400
401In this example, use the 10.0.0.4 private address as a key find the
402corresponding public address which in this example is 10.12.6.155. If you're
Eric Debeau993b77b2020-08-19 15:30:00 +0200403using OpenStack you'll do the lookup with the horizon GUI or the OpenStack CLI
Roger Maitlandda221582018-05-10 13:43:58 -0400404for your tenant (openstack server list). That IP is then used in your
405`/etc/hosts` to map the fixed DNS aliases required by the ONAP Portal as shown
406below::
407
408 10.12.6.155 portal.api.simpledemo.onap.org
409 10.12.6.155 vid.api.simpledemo.onap.org
410 10.12.6.155 sdc.api.fe.simpledemo.onap.org
andreasgeissler4a618ba2018-11-30 14:20:46 +0000411 10.12.6.155 sdc.workflow.plugin.simpledemo.onap.org
412 10.12.6.155 sdc.dcae.plugin.simpledemo.onap.org
Roger Maitlandda221582018-05-10 13:43:58 -0400413 10.12.6.155 portal-sdk.simpledemo.onap.org
414 10.12.6.155 policy.api.simpledemo.onap.org
415 10.12.6.155 aai.api.sparky.simpledemo.onap.org
416 10.12.6.155 cli.api.simpledemo.onap.org
417 10.12.6.155 msb.api.discovery.simpledemo.onap.org
andreasgeissler4a618ba2018-11-30 14:20:46 +0000418 10.12.6.155 msb.api.simpledemo.onap.org
419 10.12.6.155 clamp.api.simpledemo.onap.org
420 10.12.6.155 so.api.simpledemo.onap.org
Sylvain Desbureaux1037d752020-04-20 14:17:16 +0200421 10.12.6.155 sdc.workflow.plugin.simpledemo.onap.org
Roger Maitlandda221582018-05-10 13:43:58 -0400422
423Ensure you've disabled any proxy settings the browser you are using to access
andreasgeissler4a618ba2018-11-30 14:20:46 +0000424the portal and then simply access now the new ssl-encrypted URL:
Eric Debeauc4e405f2020-12-07 14:49:52 +0100425``https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/login.htm``
Roger Maitlandda221582018-05-10 13:43:58 -0400426
andreasgeissler4a618ba2018-11-30 14:20:46 +0000427.. note::
428 Using the HTTPS based Portal URL the Browser needs to be configured to accept
429 unsecure credentials.
430 Additionally when opening an Application inside the Portal, the Browser
431 might block the content, which requires to disable the blocking and reloading
432 of the page
433
434.. note::
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100435 Besides the ONAP Portal the Components can deliver additional user interfaces,
andreasgeissler4a618ba2018-11-30 14:20:46 +0000436 please check the Component specific documentation.
Roger Maitlandda221582018-05-10 13:43:58 -0400437
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100438.. note::
Roger Maitlandda221582018-05-10 13:43:58 -0400439
Hector Anapan-Lavalle55547da2018-07-26 13:33:17 -0400440 | Alternatives Considered:
441
442 - Kubernetes port forwarding was considered but discarded as it would require
443 the end user to run a script that opens up port forwarding tunnels to each of
444 the pods that provides a portal application widget.
445
446 - Reverting to a VNC server similar to what was deployed in the Amsterdam
447 release was also considered but there were many issues with resolution, lack
448 of volume mount, /etc/hosts dynamic update, file upload that were a tall order
449 to solve in time for the Beijing release.
450
451 Observations:
452
453 - If you are not using floating IPs in your Kubernetes deployment and directly attaching
454 a public IP address (i.e. by using your public provider network) to your K8S Node
455 VMs' network interface, then the output of 'kubectl -n onap get services | grep "portal-app"'
456 will show your public IP instead of the private network's IP. Therefore,
457 you can grab this public IP directly (as compared to trying to find the floating
458 IP first) and map this IP in /etc/hosts.
Roger Maitlandda221582018-05-10 13:43:58 -0400459
Roger Maitland953b5f12018-03-22 15:24:04 -0400460.. figure:: oomLogoV2-Monitor.png
461 :align: right
462
463Monitor
464=======
465
466All highly available systems include at least one facility to monitor the
467health of components within the system. Such health monitors are often used as
Eric Debeau993b77b2020-08-19 15:30:00 +0200468inputs to distributed coordination systems (such as etcd, Zookeeper, or Consul)
469and monitoring systems (such as Nagios or Zabbix). OOM provides two mechanisms
Roger Maitland953b5f12018-03-22 15:24:04 -0400470to monitor the real-time health of an ONAP deployment:
471
472- a Consul GUI for a human operator or downstream monitoring systems and
473 Kubernetes liveness probes that enable automatic healing of failed
474 containers, and
475- a set of liveness probes which feed into the Kubernetes manager which
476 are described in the Heal section.
477
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100478Within ONAP, Consul is the monitoring system of choice and deployed by OOM in
479two parts:
Roger Maitland953b5f12018-03-22 15:24:04 -0400480
481- a three-way, centralized Consul server cluster is deployed as a highly
Gildas Lanilis64d17ae2018-05-18 16:58:05 -0700482 available monitor of all of the ONAP components, and
Roger Maitland953b5f12018-03-22 15:24:04 -0400483- a number of Consul agents.
484
485The Consul server provides a user interface that allows a user to graphically
486view the current health status of all of the ONAP components for which agents
487have been created - a sample from the ONAP Integration labs follows:
488
489.. figure:: consulHealth.png
490 :align: center
491
Eric Debeauc4e405f2020-12-07 14:49:52 +0100492To see the real-time health of a deployment go to: ``http://<kubernetes IP>:30270/ui/``
Roger Maitland953b5f12018-03-22 15:24:04 -0400493where a GUI much like the following will be found:
494
ramagp060a51c2020-10-29 04:24:16 +0000495.. note::
496 If Consul GUI is not accessible, you can refer this
497 `kubectl port-forward <https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/>`_ method to access an application
Roger Maitland953b5f12018-03-22 15:24:04 -0400498
499.. figure:: oomLogoV2-Heal.png
500 :align: right
501
502Heal
503====
504
505The ONAP deployment is defined by Helm charts as mentioned earlier. These Helm
506charts are also used to implement automatic recoverability of ONAP components
507when individual components fail. Once ONAP is deployed, a "liveness" probe
508starts checking the health of the components after a specified startup time.
509
510Should a liveness probe indicate a failed container it will be terminated and a
511replacement will be started in its place - containers are ephemeral. Should the
512deployment specification indicate that there are one or more dependencies to
513this container or component (for example a dependency on a database) the
514dependency will be satisfied before the replacement container/component is
515started. This mechanism ensures that, after a failure, all of the ONAP
516components restart successfully.
517
518To test healing, the following command can be used to delete a pod::
519
520 > kubectl delete pod [pod name] -n [pod namespace]
521
522One could then use the following command to monitor the pods and observe the
523pod being terminated and the service being automatically healed with the
524creation of a replacement pod::
525
526 > kubectl get pods --all-namespaces -o=wide
527
528.. figure:: oomLogoV2-Scale.png
529 :align: right
530
531Scale
532=====
533
534Many of the ONAP components are horizontally scalable which allows them to
535adapt to expected offered load. During the Beijing release scaling is static,
536that is during deployment or upgrade a cluster size is defined and this cluster
537will be maintained even in the presence of faults. The parameter that controls
538the cluster size of a given component is found in the values.yaml file for that
539component. Here is an excerpt that shows this parameter:
540
541.. code-block:: yaml
542
543 # default number of instances
544 replicaCount: 1
545
546In order to change the size of a cluster, an operator could use a helm upgrade
547(described in detail in the next section) as follows::
548
ramagp060a51c2020-10-29 04:24:16 +0000549 > helm upgrade [RELEASE] [CHART] [flags]
550
551The RELEASE argument can be obtained from the following command::
552
553 > helm list
554
555Below is the example for the same::
556
557 > helm list
558 NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
559 dev 1 Wed Oct 14 13:49:52 2020 DEPLOYED onap-8.0.0 Honolulu onap
560 dev-cassandra 5 Thu Oct 15 14:45:34 2020 DEPLOYED cassandra-8.0.0 onap
561 dev-contrib 1 Wed Oct 14 13:52:53 2020 DEPLOYED contrib-8.0.0 onap
562 dev-mariadb-galera 1 Wed Oct 14 13:55:56 2020 DEPLOYED mariadb-galera-8.0.0 onap
563
564Here the Name column shows the RELEASE NAME, In our case we want to try the
565scale operation on cassandra, thus the RELEASE NAME would be dev-cassandra.
566
567Now we need to obtain the chart name for casssandra. Use the below
568command to get the chart name::
569
570 > helm search cassandra
571
572Below is the example for the same::
573
574 > helm search cassandra
575 NAME CHART VERSION APP VERSION DESCRIPTION
576 local/cassandra 8.0.0 ONAP cassandra
577 local/portal-cassandra 8.0.0 Portal cassandra
578 local/aaf-cass 8.0.0 ONAP AAF cassandra
579 local/sdc-cs 8.0.0 ONAP Service Design and Creation Cassandra
580
581Here the Name column shows the chart name. As we want to try the scale
582operation for cassandra, thus the correponding chart name is local/cassandra
583
584
585Now we have both the command's arguments, thus we can perform the
586scale opeartion for cassandra as follows::
587
588 > helm upgrade dev-cassandra local/cassandra --set replicaCount=3
589
590Using this command we can scale up or scale down the cassadra db instances.
591
Roger Maitland953b5f12018-03-22 15:24:04 -0400592
593The ONAP components use Kubernetes provided facilities to build clustered,
594highly available systems including: Services_ with load-balancers, ReplicaSet_,
595and StatefulSet_. Some of the open-source projects used by the ONAP components
596directly support clustered configurations, for example ODL and MariaDB Galera.
597
598The Kubernetes Services_ abstraction to provide a consistent access point for
599each of the ONAP components, independent of the pod or container architecture
600of that component. For example, SDN-C uses OpenDaylight clustering with a
601default cluster size of three but uses a Kubernetes service to and change the
602number of pods in this abstract this cluster from the other ONAP components
603such that the cluster could change size and this change is isolated from the
604other ONAP components by the load-balancer implemented in the ODL service
605abstraction.
606
607A ReplicaSet_ is a construct that is used to describe the desired state of the
608cluster. For example 'replicas: 3' indicates to Kubernetes that a cluster of 3
609instances is the desired state. Should one of the members of the cluster fail,
610a new member will be automatically started to replace it.
611
612Some of the ONAP components many need a more deterministic deployment; for
613example to enable intra-cluster communication. For these applications the
614component can be deployed as a Kubernetes StatefulSet_ which will maintain a
615persistent identifier for the pods and thus a stable network id for the pods.
616For example: the pod names might be web-0, web-1, web-{N-1} for N 'web' pods
617with corresponding DNS entries such that intra service communication is simple
618even if the pods are physically distributed across multiple nodes. An example
619of how these capabilities can be used is described in the Running Consul on
620Kubernetes tutorial.
621
622.. figure:: oomLogoV2-Upgrade.png
623 :align: right
624
625Upgrade
626=======
627
628Helm has built-in capabilities to enable the upgrade of pods without causing a
629loss of the service being provided by that pod or pods (if configured as a
630cluster). As described in the OOM Developer's Guide, ONAP components provide
631an abstracted 'service' end point with the pods or containers providing this
632service hidden from other ONAP components by a load balancer. This capability
633is used during upgrades to allow a pod with a new image to be added to the
634service before removing the pod with the old image. This 'make before break'
635capability ensures minimal downtime.
636
637Prior to doing an upgrade, determine of the status of the deployed charts::
638
639 > helm list
640 NAME REVISION UPDATED STATUS CHART NAMESPACE
ramagp060a51c2020-10-29 04:24:16 +0000641 so 1 Mon Feb 5 10:05:22 2020 DEPLOYED so-8.0.0 onap
Roger Maitland953b5f12018-03-22 15:24:04 -0400642
643When upgrading a cluster a parameter controls the minimum size of the cluster
644during the upgrade while another parameter controls the maximum number of nodes
645in the cluster. For example, SNDC configured as a 3-way ODL cluster might
646require that during the upgrade no fewer than 2 pods are available at all times
647to provide service while no more than 5 pods are ever deployed across the two
648versions at any one time to avoid depleting the cluster of resources. In this
649scenario, the SDNC cluster would start with 3 old pods then Kubernetes may add
650a new pod (3 old, 1 new), delete one old (2 old, 1 new), add two new pods (2
651old, 3 new) and finally delete the 2 old pods (3 new). During this sequence
652the constraints of the minimum of two pods and maximum of five would be
653maintained while providing service the whole time.
654
655Initiation of an upgrade is triggered by changes in the Helm charts. For
656example, if the image specified for one of the pods in the SDNC deployment
657specification were to change (i.e. point to a new Docker image in the nexus3
658repository - commonly through the change of a deployment variable), the
659sequence of events described in the previous paragraph would be initiated.
660
661For example, to upgrade a container by changing configuration, specifically an
662environment value::
663
ramagp060a51c2020-10-29 04:24:16 +0000664 > helm upgrade so onap/so --version 8.0.1 --set enableDebug=true
Roger Maitland953b5f12018-03-22 15:24:04 -0400665
666Issuing this command will result in the appropriate container being stopped by
667Kubernetes and replaced with a new container with the new environment value.
668
669To upgrade a component to a new version with a new configuration file enter::
670
ramagp060a51c2020-10-29 04:24:16 +0000671 > helm upgrade so onap/so --version 8.0.1 -f environments/demo.yaml
Roger Maitland953b5f12018-03-22 15:24:04 -0400672
673To fetch release history enter::
674
675 > helm history so
676 REVISION UPDATED STATUS CHART DESCRIPTION
ramagp060a51c2020-10-29 04:24:16 +0000677 1 Mon Feb 5 10:05:22 2020 SUPERSEDED so-8.0.0 Install complete
678 2 Mon Feb 5 10:10:55 2020 DEPLOYED so-8.0.1 Upgrade complete
Roger Maitland953b5f12018-03-22 15:24:04 -0400679
680Unfortunately, not all upgrades are successful. In recognition of this the
681lineup of pods within an ONAP deployment is tagged such that an administrator
682may force the ONAP deployment back to the previously tagged configuration or to
683a specific configuration, say to jump back two steps if an incompatibility
684between two ONAP components is discovered after the two individual upgrades
685succeeded.
686
687This rollback functionality gives the administrator confidence that in the
688unfortunate circumstance of a failed upgrade the system can be rapidly brought
689back to a known good state. This process of rolling upgrades while under
690service is illustrated in this short YouTube video showing a Zero Downtime
691Upgrade of a web application while under a 10 million transaction per second
692load.
693
694For example, to roll-back back to previous system revision enter::
695
696 > helm rollback so 1
697
698 > helm history so
699 REVISION UPDATED STATUS CHART DESCRIPTION
ramagp060a51c2020-10-29 04:24:16 +0000700 1 Mon Feb 5 10:05:22 2020 SUPERSEDED so-8.0.0 Install complete
701 2 Mon Feb 5 10:10:55 2020 SUPERSEDED so-8.0.1 Upgrade complete
702 3 Mon Feb 5 10:14:32 2020 DEPLOYED so-8.0.0 Rollback to 1
Roger Maitland953b5f12018-03-22 15:24:04 -0400703
704.. note::
705
706 The description field can be overridden to document actions taken or include
707 tracking numbers.
708
709Many of the ONAP components contain their own databases which are used to
710record configuration or state information. The schemas of these databases may
711change from version to version in such a way that data stored within the
712database needs to be migrated between versions. If such a migration script is
713available it can be invoked during the upgrade (or rollback) by Container
714Lifecycle Hooks. Two such hooks are available, PostStart and PreStop, which
715containers can access by registering a handler against one or both. Note that
716it is the responsibility of the ONAP component owners to implement the hook
717handlers - which could be a shell script or a call to a specific container HTTP
718endpoint - following the guidelines listed on the Kubernetes site. Lifecycle
719hooks are not restricted to database migration or even upgrades but can be used
720anywhere specific operations need to be taken during lifecycle operations.
721
722OOM uses Helm K8S package manager to deploy ONAP components. Each component is
723arranged in a packaging format called a chart - a collection of files that
724describe a set of k8s resources. Helm allows for rolling upgrades of the ONAP
725component deployed. To upgrade a component Helm release you will need an
726updated Helm chart. The chart might have modified, deleted or added values,
727deployment yamls, and more. To get the release name use::
728
729 > helm ls
730
731To easily upgrade the release use::
732
733 > helm upgrade [RELEASE] [CHART]
734
735To roll back to a previous release version use::
736
737 > helm rollback [flags] [RELEASE] [REVISION]
738
739For example, to upgrade the onap-so helm release to the latest SO container
740release v1.1.2:
741
742- Edit so values.yaml which is part of the chart
743- Change "so: nexus3.onap.org:10001/openecomp/so:v1.1.1" to
744 "so: nexus3.onap.org:10001/openecomp/so:v1.1.2"
745- From the chart location run::
746
747 > helm upgrade onap-so
748
749The previous so pod will be terminated and a new so pod with an updated so
750container will be created.
751
752.. figure:: oomLogoV2-Delete.png
753 :align: right
754
755Delete
756======
757
758Existing deployments can be partially or fully removed once they are no longer
759needed. To minimize errors it is recommended that before deleting components
760from a running deployment the operator perform a 'dry-run' to display exactly
ramagp060a51c2020-10-29 04:24:16 +0000761what will happen with a given command prior to actually deleting anything.
762For example::
Roger Maitland953b5f12018-03-22 15:24:04 -0400763
Sylvain Desbureaux5e19e242020-03-02 14:41:48 +0100764 > helm undeploy onap --dry-run
Roger Maitland953b5f12018-03-22 15:24:04 -0400765
Sylvain Desbureaux5e19e242020-03-02 14:41:48 +0100766will display the outcome of deleting the 'onap' release from the
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100767deployment.
Roger Maitland953b5f12018-03-22 15:24:04 -0400768To completely delete a release and remove it from the internal store enter::
769
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100770 > helm undeploy onap
Roger Maitland953b5f12018-03-22 15:24:04 -0400771
ramagp060a51c2020-10-29 04:24:16 +0000772Once complete undeploy is done then delete the namespace as well
773using following command::
774
775 > kubectl delete namespace <name of namespace>
776
777.. note::
778 You need to provide the namespace name which you used during deployment,
779 below is the example::
780
781 > kubectl delete namespace onap
782
Roger Maitland953b5f12018-03-22 15:24:04 -0400783One can also remove individual components from a deployment by changing the
784ONAP configuration values. For example, to remove `so` from a running
785deployment enter::
786
Sylvain Desbureaux557628a2021-03-24 14:59:16 +0100787 > helm undeploy onap-so
Roger Maitland953b5f12018-03-22 15:24:04 -0400788
789will remove `so` as the configuration indicates it's no longer part of the
790deployment. This might be useful if a one wanted to replace just `so` by
Sylvain Desbureaux983c7552019-01-28 13:59:43 +0100791installing a custom version.