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