1 .. 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
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/
13 .. _Kubernetes LoadBalancer: https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer
19 The ONAP Operations Manager (OOM) provide the ability to manage the entire
20 life-cycle of an ONAP installation, from the initial deployment to final
21 decommissioning. This guide provides instructions for users of ONAP to
22 use the Kubernetes_/Helm_ system as a complete ONAP management system.
24 This guide provides many examples of Helm command line operations. For a
25 complete description of these commands please refer to the `Helm
28 .. figure:: oomLogoV2-medium.png
31 The following sections describe the life-cycle operations:
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
41 .. figure:: oomLogoV2-Deploy.png
47 The OOM team with assistance from the ONAP project teams, have built a
48 comprehensive set of Helm charts, yaml files very similar to TOSCA files, that
49 describe the composition of each of the ONAP components and the relationship
50 within and between components. Using this model Helm is able to deploy all of
51 ONAP with a few simple commands.
55 Your environment must have both the Kubernetes `kubectl` and Helm setup as a one time activity.
59 Enter the following to install kubectl (on Ubuntu, there are slight differences on other O/Ss), the Kubernetes command line interface used to manage a Kubernetes cluster::
61 > curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl
63 > sudo mv ./kubectl /usr/local/bin/kubectl
66 Paste kubectl config from Rancher (see the :ref:`cloud-setup-guide-label` for alternative Kubernetes environment setups) into the `~/.kube/config` file.
68 Verify that the Kubernetes config is correct::
70 > kubectl get pods --all-namespaces
72 At this point you should see six Kubernetes pods running.
76 Helm is used by OOM for package and configuration management. To install Helm, enter the following::
78 > wget http://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
79 > tar -zxvf helm-v2.9.1-linux-amd64.tar.gz
80 > sudo mv linux-amd64/helm /usr/local/bin/helm
82 Verify the Helm version with::
86 Install the Helm Tiller application and initialize with::
92 Once kubectl and Helm are setup, one needs to setup a local Helm server to server up the ONAP charts::
94 > helm install osn/onap
97 The osn repo is not currently available so creation of a local repository is
100 Helm is able to use charts served up from a repository and comes setup with a
101 default CNCF provided `Curated applications for Kubernetes`_ repository called
102 stable which should be removed to avoid confusion::
104 > helm repo remove stable
106 .. To setup the Open Source Networking Nexus repository for helm enter::
107 .. > helm repo add osn 'https://nexus3.onap.org:10001/helm/helm-repo-in-nexus/master/'
109 To prepare your system for an installation of ONAP, you'll need to::
111 > git clone -b casablanca http://gerrit.onap.org/r/oom
115 To setup a local Helm server to server up the ONAP charts::
120 Note the port number that is listed and use it in the Helm repo add as follows::
122 > helm repo add local http://127.0.0.1:8879
124 To get a list of all of the available Helm chart repositories::
128 local http://127.0.0.1:8879
130 Then build your local Helm repository::
134 The Helm search command reads through all of the repositories configured on the
135 system, and looks for matches::
138 NAME VERSION DESCRIPTION
139 local/appc 2.0.0 Application Controller
140 local/clamp 2.0.0 ONAP Clamp
141 local/common 2.0.0 Common templates for inclusion in other charts
142 local/onap 2.0.0 Open Network Automation Platform (ONAP)
143 local/robot 2.0.0 A helm Chart for kubernetes-ONAP Robot
144 local/so 2.0.0 ONAP Service Orchestrator
146 In any case, setup of the Helm repository is a one time activity.
148 Next, install Helm Plugins required to deploy the ONAP Casablanca release::
150 > cp -R helm/plugins/ ~/.helm
152 Once the repo is setup, installation of ONAP can be done with a single command::
154 > helm deploy development local/onap --namespace onap
156 This will install ONAP from a local repository in a 'development' Helm release.
157 As described below, to override the default configuration values provided by
158 OOM, an environment file can be provided on the command line as follows::
160 > helm deploy development local/onap --namespace onap -f overrides.yaml
162 To get a summary of the status of all of the pods (containers) running in your
165 > kubectl get pods --all-namespaces -o=wide
168 The Kubernetes namespace concept allows for multiple instances of a component
169 (such as all of ONAP) to co-exist with other components in the same
170 Kubernetes cluster by isolating them entirely. Namespaces share only the
171 hosts that form the cluster thus providing isolation between production and
172 development systems as an example. The OOM deployment of ONAP in Beijing is
173 now done within a single Kubernetes namespace where in Amsterdam a namespace
174 was created for each of the ONAP components.
177 The Helm `--name` option refers to a release name and not a Kubernetes namespace.
180 To install a specific version of a single ONAP component (`so` in this example)
181 with the given release name enter::
183 > helm deploy so onap/so --version 3.0.1
185 To display details of a specific resource or group of resources type::
187 > kubectl describe pod so-1071802958-6twbl
189 where the pod identifier refers to the auto-generated pod identifier.
191 .. figure:: oomLogoV2-Configure.png
197 Each project within ONAP has its own configuration data generally consisting
198 of: environment variables, configuration files, and database initial values.
199 Many technologies are used across the projects resulting in significant
200 operational complexity and an inability to apply global parameters across the
201 entire ONAP deployment. OOM solves this problem by introducing a common
202 configuration technology, Helm charts, that provide a hierarchical
203 configuration with the ability to override values with higher
204 level charts or command line options.
206 The structure of the configuration of ONAP is shown in the following diagram.
207 Note that key/value pairs of a parent will always take precedence over those
208 of a child. Also note that values set on the command line have the highest
216 oValues [label="values.yaml"]
217 demo [label="onap-demo.yaml"]
218 prod [label="onap-production.yaml"]
219 oReq [label="requirements.yaml"]
220 soValues [label="values.yaml"]
221 soReq [label="requirements.yaml"]
222 mdValues [label="values.yaml"]
225 oResources [label="resources"]
229 oResources -> environments
242 The top level onap/values.yaml file contains the values required to be set
243 before deploying ONAP. Here is the contents of this file:
245 .. include:: onap_values.yaml
248 One may wish to create a value file that is specific to a given deployment such
249 that it can be differentiated from other deployments. For example, a
250 onap-development.yaml file may create a minimal environment for development
251 while onap-production.yaml might describe a production deployment that operates
252 independently of the developer version.
254 For example, if the production OpenStack instance was different from a
255 developer's instance, the onap-production.yaml file may contain a different
256 value for the vnfDeployment/openstack/oam_network_cidr key as shown below.
262 apps: consul msb mso message-router sdnc vid robot portal policy appc aai
263 sdc dcaegen2 log cli multicloud clamp vnfsdk aaf kube2msb
264 dataRootDir: /dockerdata-nfs
266 # docker repositories
268 onap: nexus3.onap.org:10001
271 filebeat: docker.elastic.co
276 # vnf deployment environment
279 ubuntu_14_image: "Ubuntu_14.04.5_LTS"
280 public_net_id: "e8f51956-00dd-4425-af36-045716781ffc"
281 oam_network_id: "d4769dfb-c9e4-4f72-b3d6-1d18f4ac4ee6"
282 oam_subnet_id: "191f7580-acf6-4c2b-8ec0-ba7d99b3bc4e"
283 oam_network_cidr: "192.168.30.0/24"
287 To deploy ONAP with this environment file, enter::
289 > helm deploy local/onap -n casablanca -f environments/onap-production.yaml
291 .. include:: environments_onap_demo.yaml
294 When deploying all of ONAP a requirements.yaml file control which and what
295 version of the ONAP components are included. Here is an excerpt of this
300 # Referencing a named repo called 'local'.
301 # Can add this repo by running commands like:
303 # > helm repo add local http://127.0.0.1:8879
309 condition: so.enabled
312 The ~ operator in the `so` version value indicates that the latest "2.X.X"
313 version of `so` shall be used thus allowing the chart to allow for minor
314 upgrades that don't impact the so API; hence, version 2.0.1 will be installed
317 The onap/resources/environment/onap-dev.yaml (see the excerpt below) enables
318 for fine grained control on what components are included as part of this
319 deployment. By changing this `so` line to `enabled: false` the `so` component
320 will not be deployed. If this change is part of an upgrade the existing `so`
321 component will be shut down. Other `so` parameters and even `so` child values
322 can be modified, for example the `so`'s `liveness` probe could be disabled
323 (which is not recommended as this change would disable auto-healing of `so`).
327 #################################################################
328 # Global configuration overrides.
330 # These overrides will affect all helm charts (ie. applications)
331 # that are listed below and are 'enabled'.
332 #################################################################
336 #################################################################
337 # Enable/disable and configure helm charts (ie. applications)
338 # to customize the ONAP deployment.
339 #################################################################
343 so: # Service Orchestrator
349 # necessary to disable liveness probe when setting breakpoints
350 # in debugger so K8s doesn't restart unresponsive container
355 Accessing the ONAP Portal using OOM and a Kubernetes Cluster
356 ------------------------------------------------------------
358 The ONAP deployment created by OOM operates in a private IP network that isn't
359 publicly accessible (i.e. Openstack VMs with private internal network) which
360 blocks access to the ONAP Portal. To enable direct access to this Portal from a
361 user's own environment (a laptop etc.) the portal application's port 8989 is
362 exposed through a `Kubernetes LoadBalancer`_ object.
364 Typically, to be able to access the Kubernetes nodes publicly a public address is
365 assigned. In Openstack this is a floating IP address.
367 When the `portal-app` chart is deployed a Kubernetes service is created that
368 instantiates a load balancer. The LB chooses the private interface of one of
369 the nodes as in the example below (10.0.0.4 is private to the K8s cluster only).
370 Then to be able to access the portal on port 8989 from outside the K8s &
371 Openstack environment, the user needs to assign/get the floating IP address that
372 corresponds to the private IP as follows::
374 > kubectl -n onap get services|grep "portal-app"
375 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
378 In this example, use the 10.0.0.4 private address as a key find the
379 corresponding public address which in this example is 10.12.6.155. If you're
380 using OpenStack you'll do the lookup with the horizon GUI or the Openstack CLI
381 for your tenant (openstack server list). That IP is then used in your
382 `/etc/hosts` to map the fixed DNS aliases required by the ONAP Portal as shown
385 10.12.6.155 portal.api.simpledemo.onap.org
386 10.12.6.155 vid.api.simpledemo.onap.org
387 10.12.6.155 sdc.api.fe.simpledemo.onap.org
388 10.12.6.155 sdc.workflow.plugin.simpledemo.onap.org
389 10.12.6.155 sdc.dcae.plugin.simpledemo.onap.org
390 10.12.6.155 portal-sdk.simpledemo.onap.org
391 10.12.6.155 policy.api.simpledemo.onap.org
392 10.12.6.155 aai.api.sparky.simpledemo.onap.org
393 10.12.6.155 cli.api.simpledemo.onap.org
394 10.12.6.155 msb.api.discovery.simpledemo.onap.org
395 10.12.6.155 msb.api.simpledemo.onap.org
396 10.12.6.155 clamp.api.simpledemo.onap.org
397 10.12.6.155 so.api.simpledemo.onap.org
399 Ensure you've disabled any proxy settings the browser you are using to access
400 the portal and then simply access now the new ssl-encrypted URL:
401 https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/login.htm
404 Using the HTTPS based Portal URL the Browser needs to be configured to accept
405 unsecure credentials.
406 Additionally when opening an Application inside the Portal, the Browser
407 might block the content, which requires to disable the blocking and reloading
411 Besides the ONAP Portal the Components can deliver additional user interfaces,
412 please check the Component specific documentation.
416 | Alternatives Considered:
418 - Kubernetes port forwarding was considered but discarded as it would require
419 the end user to run a script that opens up port forwarding tunnels to each of
420 the pods that provides a portal application widget.
422 - Reverting to a VNC server similar to what was deployed in the Amsterdam
423 release was also considered but there were many issues with resolution, lack
424 of volume mount, /etc/hosts dynamic update, file upload that were a tall order
425 to solve in time for the Beijing release.
429 - If you are not using floating IPs in your Kubernetes deployment and directly attaching
430 a public IP address (i.e. by using your public provider network) to your K8S Node
431 VMs' network interface, then the output of 'kubectl -n onap get services | grep "portal-app"'
432 will show your public IP instead of the private network's IP. Therefore,
433 you can grab this public IP directly (as compared to trying to find the floating
434 IP first) and map this IP in /etc/hosts.
436 .. figure:: oomLogoV2-Monitor.png
442 All highly available systems include at least one facility to monitor the
443 health of components within the system. Such health monitors are often used as
444 inputs to distributed coordination systems (such as etcd, zookeeper, or consul)
445 and monitoring systems (such as nagios or zabbix). OOM provides two mechanisms
446 to monitor the real-time health of an ONAP deployment:
448 - a Consul GUI for a human operator or downstream monitoring systems and
449 Kubernetes liveness probes that enable automatic healing of failed
451 - a set of liveness probes which feed into the Kubernetes manager which
452 are described in the Heal section.
454 Within ONAP, Consul is the monitoring system of choice and deployed by OOM in two parts:
456 - a three-way, centralized Consul server cluster is deployed as a highly
457 available monitor of all of the ONAP components, and
458 - a number of Consul agents.
460 The Consul server provides a user interface that allows a user to graphically
461 view the current health status of all of the ONAP components for which agents
462 have been created - a sample from the ONAP Integration labs follows:
464 .. figure:: consulHealth.png
467 To see the real-time health of a deployment go to: http://<kubernetes IP>:30270/ui/
468 where a GUI much like the following will be found:
471 .. figure:: oomLogoV2-Heal.png
477 The ONAP deployment is defined by Helm charts as mentioned earlier. These Helm
478 charts are also used to implement automatic recoverability of ONAP components
479 when individual components fail. Once ONAP is deployed, a "liveness" probe
480 starts checking the health of the components after a specified startup time.
482 Should a liveness probe indicate a failed container it will be terminated and a
483 replacement will be started in its place - containers are ephemeral. Should the
484 deployment specification indicate that there are one or more dependencies to
485 this container or component (for example a dependency on a database) the
486 dependency will be satisfied before the replacement container/component is
487 started. This mechanism ensures that, after a failure, all of the ONAP
488 components restart successfully.
490 To test healing, the following command can be used to delete a pod::
492 > kubectl delete pod [pod name] -n [pod namespace]
494 One could then use the following command to monitor the pods and observe the
495 pod being terminated and the service being automatically healed with the
496 creation of a replacement pod::
498 > kubectl get pods --all-namespaces -o=wide
500 .. figure:: oomLogoV2-Scale.png
506 Many of the ONAP components are horizontally scalable which allows them to
507 adapt to expected offered load. During the Beijing release scaling is static,
508 that is during deployment or upgrade a cluster size is defined and this cluster
509 will be maintained even in the presence of faults. The parameter that controls
510 the cluster size of a given component is found in the values.yaml file for that
511 component. Here is an excerpt that shows this parameter:
515 # default number of instances
518 In order to change the size of a cluster, an operator could use a helm upgrade
519 (described in detail in the next section) as follows::
521 > helm upgrade --set replicaCount=3 onap/so/mariadb
523 The ONAP components use Kubernetes provided facilities to build clustered,
524 highly available systems including: Services_ with load-balancers, ReplicaSet_,
525 and StatefulSet_. Some of the open-source projects used by the ONAP components
526 directly support clustered configurations, for example ODL and MariaDB Galera.
528 The Kubernetes Services_ abstraction to provide a consistent access point for
529 each of the ONAP components, independent of the pod or container architecture
530 of that component. For example, SDN-C uses OpenDaylight clustering with a
531 default cluster size of three but uses a Kubernetes service to and change the
532 number of pods in this abstract this cluster from the other ONAP components
533 such that the cluster could change size and this change is isolated from the
534 other ONAP components by the load-balancer implemented in the ODL service
537 A ReplicaSet_ is a construct that is used to describe the desired state of the
538 cluster. For example 'replicas: 3' indicates to Kubernetes that a cluster of 3
539 instances is the desired state. Should one of the members of the cluster fail,
540 a new member will be automatically started to replace it.
542 Some of the ONAP components many need a more deterministic deployment; for
543 example to enable intra-cluster communication. For these applications the
544 component can be deployed as a Kubernetes StatefulSet_ which will maintain a
545 persistent identifier for the pods and thus a stable network id for the pods.
546 For example: the pod names might be web-0, web-1, web-{N-1} for N 'web' pods
547 with corresponding DNS entries such that intra service communication is simple
548 even if the pods are physically distributed across multiple nodes. An example
549 of how these capabilities can be used is described in the Running Consul on
552 .. figure:: oomLogoV2-Upgrade.png
558 Helm has built-in capabilities to enable the upgrade of pods without causing a
559 loss of the service being provided by that pod or pods (if configured as a
560 cluster). As described in the OOM Developer's Guide, ONAP components provide
561 an abstracted 'service' end point with the pods or containers providing this
562 service hidden from other ONAP components by a load balancer. This capability
563 is used during upgrades to allow a pod with a new image to be added to the
564 service before removing the pod with the old image. This 'make before break'
565 capability ensures minimal downtime.
567 Prior to doing an upgrade, determine of the status of the deployed charts::
570 NAME REVISION UPDATED STATUS CHART NAMESPACE
571 so 1 Mon Feb 5 10:05:22 2018 DEPLOYED so-2.0.1 default
573 When upgrading a cluster a parameter controls the minimum size of the cluster
574 during the upgrade while another parameter controls the maximum number of nodes
575 in the cluster. For example, SNDC configured as a 3-way ODL cluster might
576 require that during the upgrade no fewer than 2 pods are available at all times
577 to provide service while no more than 5 pods are ever deployed across the two
578 versions at any one time to avoid depleting the cluster of resources. In this
579 scenario, the SDNC cluster would start with 3 old pods then Kubernetes may add
580 a new pod (3 old, 1 new), delete one old (2 old, 1 new), add two new pods (2
581 old, 3 new) and finally delete the 2 old pods (3 new). During this sequence
582 the constraints of the minimum of two pods and maximum of five would be
583 maintained while providing service the whole time.
585 Initiation of an upgrade is triggered by changes in the Helm charts. For
586 example, if the image specified for one of the pods in the SDNC deployment
587 specification were to change (i.e. point to a new Docker image in the nexus3
588 repository - commonly through the change of a deployment variable), the
589 sequence of events described in the previous paragraph would be initiated.
591 For example, to upgrade a container by changing configuration, specifically an
594 > helm deploy casablanca onap/so --version 2.0.1 --set enableDebug=true
596 Issuing this command will result in the appropriate container being stopped by
597 Kubernetes and replaced with a new container with the new environment value.
599 To upgrade a component to a new version with a new configuration file enter::
601 > helm deploy casablanca onap/so --version 2.0.2 -f environments/demo.yaml
603 To fetch release history enter::
606 REVISION UPDATED STATUS CHART DESCRIPTION
607 1 Mon Feb 5 10:05:22 2018 SUPERSEDED so-2.0.1 Install complete
608 2 Mon Feb 5 10:10:55 2018 DEPLOYED so-2.0.2 Upgrade complete
610 Unfortunately, not all upgrades are successful. In recognition of this the
611 lineup of pods within an ONAP deployment is tagged such that an administrator
612 may force the ONAP deployment back to the previously tagged configuration or to
613 a specific configuration, say to jump back two steps if an incompatibility
614 between two ONAP components is discovered after the two individual upgrades
617 This rollback functionality gives the administrator confidence that in the
618 unfortunate circumstance of a failed upgrade the system can be rapidly brought
619 back to a known good state. This process of rolling upgrades while under
620 service is illustrated in this short YouTube video showing a Zero Downtime
621 Upgrade of a web application while under a 10 million transaction per second
624 For example, to roll-back back to previous system revision enter::
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 SUPERSEDED so-2.0.2 Upgrade complete
632 3 Mon Feb 5 10:14:32 2018 DEPLOYED so-2.0.1 Rollback to 1
636 The description field can be overridden to document actions taken or include
639 Many of the ONAP components contain their own databases which are used to
640 record configuration or state information. The schemas of these databases may
641 change from version to version in such a way that data stored within the
642 database needs to be migrated between versions. If such a migration script is
643 available it can be invoked during the upgrade (or rollback) by Container
644 Lifecycle Hooks. Two such hooks are available, PostStart and PreStop, which
645 containers can access by registering a handler against one or both. Note that
646 it is the responsibility of the ONAP component owners to implement the hook
647 handlers - which could be a shell script or a call to a specific container HTTP
648 endpoint - following the guidelines listed on the Kubernetes site. Lifecycle
649 hooks are not restricted to database migration or even upgrades but can be used
650 anywhere specific operations need to be taken during lifecycle operations.
652 OOM uses Helm K8S package manager to deploy ONAP components. Each component is
653 arranged in a packaging format called a chart - a collection of files that
654 describe a set of k8s resources. Helm allows for rolling upgrades of the ONAP
655 component deployed. To upgrade a component Helm release you will need an
656 updated Helm chart. The chart might have modified, deleted or added values,
657 deployment yamls, and more. To get the release name use::
661 To easily upgrade the release use::
663 > helm upgrade [RELEASE] [CHART]
665 To roll back to a previous release version use::
667 > helm rollback [flags] [RELEASE] [REVISION]
669 For example, to upgrade the onap-so helm release to the latest SO container
672 - Edit so values.yaml which is part of the chart
673 - Change "so: nexus3.onap.org:10001/openecomp/so:v1.1.1" to
674 "so: nexus3.onap.org:10001/openecomp/so:v1.1.2"
675 - From the chart location run::
677 > helm upgrade onap-so
679 The previous so pod will be terminated and a new so pod with an updated so
680 container will be created.
682 .. figure:: oomLogoV2-Delete.png
688 Existing deployments can be partially or fully removed once they are no longer
689 needed. To minimize errors it is recommended that before deleting components
690 from a running deployment the operator perform a 'dry-run' to display exactly
691 what will happen with a given command prior to actually deleting anything. For
694 > helm undeploy casablanca --dry-run
696 will display the outcome of deleting the 'casablanca' release from the deployment.
697 To completely delete a release and remove it from the internal store enter::
699 > helm undeploy casablanca --purge
701 One can also remove individual components from a deployment by changing the
702 ONAP configuration values. For example, to remove `so` from a running
705 > helm undeploy casablanca-so --purge
707 will remove `so` as the configuration indicates it's no longer part of the
708 deployment. This might be useful if a one wanted to replace just `so` by
709 installing a custom version.