Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 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 |
| 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 Maitland | da22158 | 2018-05-10 13:43:58 -0400 | [diff] [blame] | 13 | .. _Kubernetes LoadBalancer: https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 14 | .. _user-guide-label: |
| 15 | |
| 16 | OOM User Guide |
| 17 | ############## |
| 18 | |
| 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. |
| 23 | |
| 24 | This guide provides many examples of Helm command line operations. For a |
| 25 | complete description of these commands please refer to the `Helm |
| 26 | Documentation`_. |
| 27 | |
| 28 | .. figure:: oomLogoV2-medium.png |
| 29 | :align: right |
| 30 | |
| 31 | The 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 | |
| 44 | Deploy |
| 45 | ====== |
| 46 | |
| 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 |
Roger Maitland | bb8adda | 2018-04-05 16:18:11 -0400 | [diff] [blame] | 51 | ONAP with a few simple commands. |
| 52 | |
| 53 | Pre-requisites |
| 54 | -------------- |
| 55 | Your environment must have both the Kubernetes `kubectl` and Helm setup as a one time activity. |
| 56 | |
| 57 | Install Kubectl |
| 58 | ~~~~~~~~~~~~~~~ |
| 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:: |
| 60 | |
Michael O'Brien | 42d87d0 | 2018-04-18 17:17:54 -0400 | [diff] [blame] | 61 | > curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl |
Roger Maitland | bb8adda | 2018-04-05 16:18:11 -0400 | [diff] [blame] | 62 | > chmod +x ./kubectl |
| 63 | > sudo mv ./kubectl /usr/local/bin/kubectl |
| 64 | > mkdir ~/.kube |
| 65 | |
| 66 | Paste kubectl config from Rancher (see the :ref:`cloud-setup-guide-label` for alternative Kubenetes environment setups) into the `~/.kube/config` file. |
| 67 | |
| 68 | Verify that the Kubernetes config is correct:: |
| 69 | |
| 70 | > kubectl get pods --all-namespaces |
| 71 | |
| 72 | At this point you should see six Kubernetes pods running. |
| 73 | |
| 74 | Install Helm |
| 75 | ~~~~~~~~~~~~ |
| 76 | Helm is used by OOM for package and configuration management. To install Helm, enter the following:: |
| 77 | |
Cong Phuoc Hoang | 6161506 | 2018-06-04 00:41:34 +0900 | [diff] [blame] | 78 | > wget http://storage.googleapis.com/kubernetes-helm/helm-v2.8.2-linux-amd64.tar.gz |
| 79 | > tar -zxvf helm-v2.8.2-linux-amd64.tar.gz |
Roger Maitland | bb8adda | 2018-04-05 16:18:11 -0400 | [diff] [blame] | 80 | > sudo mv linux-amd64/helm /usr/local/bin/helm |
| 81 | |
| 82 | Verify the Helm version with:: |
| 83 | |
| 84 | > helm version |
| 85 | |
| 86 | Install the Helm Tiller application and initialize with:: |
| 87 | |
| 88 | > helm init |
| 89 | |
| 90 | Install the Helm Repo |
| 91 | --------------------- |
| 92 | Once kubectl and Helm are setup, one needs to setup a local Helm server to server up the ONAP charts:: |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 93 | |
| 94 | > helm install osn/onap |
| 95 | |
| 96 | .. note:: |
| 97 | The osn repo is not currently available so creation of a local repository is |
| 98 | required. |
| 99 | |
| 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:: |
| 103 | |
| 104 | > helm repo remove stable |
| 105 | |
| 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/' |
| 108 | |
| 109 | To prepare your system for an installation of ONAP, you'll need to:: |
| 110 | |
Roger Maitland | 8476bbe | 2018-06-07 10:07:31 -0400 | [diff] [blame^] | 111 | > git clone -b beijing http://gerrit.onap.org/r/oom |
Roger Maitland | bb8adda | 2018-04-05 16:18:11 -0400 | [diff] [blame] | 112 | > cd oom/kubernetes |
| 113 | |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 114 | |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 115 | To setup a local Helm server to server up the ONAP charts:: |
| 116 | |
Roger Maitland | bb8adda | 2018-04-05 16:18:11 -0400 | [diff] [blame] | 117 | > helm init |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 118 | > helm serve & |
| 119 | |
| 120 | Note the port number that is listed and use it in the Helm repo add as follows:: |
| 121 | |
| 122 | > helm repo add local http://127.0.0.1:8879 |
| 123 | |
| 124 | To get a list of all of the available Helm chart repositories:: |
| 125 | |
| 126 | > helm repo list |
| 127 | NAME URL |
| 128 | local http://127.0.0.1:8879 |
| 129 | |
Roger Maitland | 9e5067c | 2018-03-27 10:57:08 -0400 | [diff] [blame] | 130 | Then build your local Helm repository:: |
| 131 | |
| 132 | > make all |
| 133 | |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 134 | The Helm search command reads through all of the repositories configured on the |
| 135 | system, and looks for matches:: |
| 136 | |
| 137 | > helm search -l |
| 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 |
| 145 | |
| 146 | In any case, setup of the Helm repository is a one time activity. |
| 147 | |
| 148 | Once the repo is setup, installation of ONAP can be done with a single command:: |
| 149 | |
Roger Maitland | d96413f | 2018-04-09 10:06:07 -0400 | [diff] [blame] | 150 | > helm install local/onap --name development |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 151 | |
| 152 | This will install ONAP from a local repository in a 'development' Helm release. |
| 153 | As described below, to override the default configuration values provided by |
| 154 | OOM, an environment file can be provided on the command line as follows:: |
| 155 | |
Roger Maitland | d96413f | 2018-04-09 10:06:07 -0400 | [diff] [blame] | 156 | > helm install local/onap --name development -f onap-development.yaml |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 157 | |
| 158 | To get a summary of the status of all of the pods (containers) running in your |
| 159 | deployment:: |
| 160 | |
| 161 | > kubectl get pods --all-namespaces -o=wide |
| 162 | |
| 163 | .. note:: |
| 164 | The Kubernetes namespace concept allows for multiple instances of a component |
| 165 | (such as all of ONAP) to co-exist with other components in the same |
| 166 | Kubernetes cluster by isolating them entirely. Namespaces share only the |
| 167 | hosts that form the cluster thus providing isolation between production and |
| 168 | development systems as an example. The OOM deployment of ONAP in Beijing is |
| 169 | now done within a single Kubernetes namespace where in Amsterdam a namespace |
| 170 | was created for each of the ONAP components. |
| 171 | |
| 172 | .. note:: |
Roger Maitland | d96413f | 2018-04-09 10:06:07 -0400 | [diff] [blame] | 173 | The Helm `--name` option refers to a release name and not a Kubernetes namespace. |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 174 | |
| 175 | |
| 176 | To install a specific version of a single ONAP component (`so` in this example) |
| 177 | with the given name enter:: |
| 178 | |
| 179 | > helm install onap/so --version 2.0.1 -n so |
| 180 | |
| 181 | To display details of a specific resource or group of resources type:: |
| 182 | |
| 183 | > kubectl describe pod so-1071802958-6twbl |
| 184 | |
| 185 | where the pod identifier refers to the auto-generated pod identifier. |
| 186 | |
| 187 | .. figure:: oomLogoV2-Configure.png |
| 188 | :align: right |
| 189 | |
| 190 | Configure |
| 191 | ========= |
| 192 | |
| 193 | Each project within ONAP has its own configuration data generally consisting |
| 194 | of: environment variables, configuration files, and database initial values. |
| 195 | Many technologies are used across the projects resulting in significant |
| 196 | operational complexity and an inability to apply global parameters across the |
| 197 | entire ONAP deployment. OOM solves this problem by introducing a common |
| 198 | configuration technology, Helm charts, that provide a hierarchical |
Gildas Lanilis | 64d17ae | 2018-05-18 16:58:05 -0700 | [diff] [blame] | 199 | configuration with the ability to override values with higher |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 200 | level charts or command line options. |
| 201 | |
| 202 | The structure of the configuration of ONAP is shown in the following diagram. |
| 203 | Note that key/value pairs of a parent will always take precedence over those |
| 204 | of a child. Also note that values set on the command line have the highest |
| 205 | precedence of all. |
| 206 | |
| 207 | .. graphviz:: |
| 208 | |
| 209 | digraph config { |
| 210 | { |
| 211 | node [shape=folder] |
| 212 | oValues [label="values.yaml"] |
| 213 | demo [label="onap-demo.yaml"] |
| 214 | prod [label="onap-production.yaml"] |
| 215 | oReq [label="requirements.yaml"] |
| 216 | soValues [label="values.yaml"] |
| 217 | soReq [label="requirements.yaml"] |
| 218 | mdValues [label="values.yaml"] |
| 219 | } |
| 220 | { |
| 221 | oResources [label="resources"] |
| 222 | } |
| 223 | onap -> oResources |
| 224 | onap -> oValues |
| 225 | oResources -> environments |
| 226 | oResources -> oReq |
| 227 | oReq -> so |
| 228 | environments -> demo |
| 229 | environments -> prod |
| 230 | so -> soValues |
| 231 | so -> soReq |
| 232 | so -> charts |
| 233 | charts -> mariadb |
| 234 | mariadb -> mdValues |
| 235 | |
| 236 | } |
| 237 | |
| 238 | The top level onap/values.yaml file contains the values required to be set |
| 239 | before deploying ONAP. Here is the contents of this file: |
| 240 | |
| 241 | .. include:: onap_values.yaml |
| 242 | :code: yaml |
| 243 | |
| 244 | One may wish to create a value file that is specific to a given deployment such |
| 245 | that it can be differentiated from other deployments. For example, a |
| 246 | onap-development.yaml file may create a minimal environment for development |
| 247 | while onap-production.yaml might describe a production deployment that operates |
| 248 | independently of the developer version. |
| 249 | |
| 250 | For example, if the production OpenStack instance was different from a |
| 251 | developer's instance, the onap-production.yaml file may contain a different |
| 252 | value for the vnfDeployment/openstack/oam_network_cidr key as shown below. |
| 253 | |
| 254 | .. code-block:: yaml |
| 255 | |
| 256 | nsPrefix: onap |
| 257 | nodePortPrefix: 302 |
| 258 | apps: consul msb mso message-router sdnc vid robot portal policy appc aai |
| 259 | sdc dcaegen2 log cli multicloud clamp vnfsdk aaf kube2msb |
| 260 | dataRootDir: /dockerdata-nfs |
| 261 | |
| 262 | # docker repositories |
| 263 | repository: |
| 264 | onap: nexus3.onap.org:10001 |
| 265 | oom: oomk8s |
| 266 | aai: aaionap |
| 267 | filebeat: docker.elastic.co |
| 268 | |
| 269 | image: |
| 270 | pullPolicy: Never |
| 271 | |
| 272 | # vnf deployment environment |
| 273 | vnfDeployment: |
| 274 | openstack: |
| 275 | ubuntu_14_image: "Ubuntu_14.04.5_LTS" |
| 276 | public_net_id: "e8f51956-00dd-4425-af36-045716781ffc" |
| 277 | oam_network_id: "d4769dfb-c9e4-4f72-b3d6-1d18f4ac4ee6" |
| 278 | oam_subnet_id: "191f7580-acf6-4c2b-8ec0-ba7d99b3bc4e" |
| 279 | oam_network_cidr: "192.168.30.0/24" |
| 280 | <...> |
| 281 | |
| 282 | |
| 283 | To deploy ONAP with this environment file, enter:: |
| 284 | |
| 285 | > helm install local/onap -n beijing -f environments/onap-production.yaml |
| 286 | |
| 287 | .. include:: environments_onap_demo.yaml |
| 288 | :code: yaml |
| 289 | |
| 290 | When deploying all of ONAP a requirements.yaml file control which and what |
| 291 | version of the ONAP components are included. Here is an excerpt of this |
| 292 | file: |
| 293 | |
| 294 | .. code-block:: yaml |
| 295 | |
| 296 | # Referencing a named repo called 'local'. |
| 297 | # Can add this repo by running commands like: |
| 298 | # > helm serve |
| 299 | # > helm repo add local http://127.0.0.1:8879 |
| 300 | dependencies: |
| 301 | <...> |
| 302 | - name: so |
| 303 | version: ~2.0.0 |
| 304 | repository: '@local' |
| 305 | condition: so.enabled |
| 306 | <...> |
| 307 | |
| 308 | The ~ operator in the `so` version value indicates that the latest "2.X.X" |
| 309 | version of `so` shall be used thus allowing the chart to allow for minor |
| 310 | upgrades that don't impact the so API; hence, version 2.0.1 will be installed |
| 311 | in this case. |
| 312 | |
| 313 | The onap/resources/environment/onap-dev.yaml (see the excerpt below) enables |
| 314 | for fine grained control on what components are included as part of this |
| 315 | deployment. By changing this `so` line to `enabled: false` the `so` component |
| 316 | will not be deployed. If this change is part of an upgrade the existing `so` |
| 317 | component will be shut down. Other `so` parameters and even `so` child values |
| 318 | can be modified, for example the `so`'s `liveness` probe could be disabled |
| 319 | (which is not recommended as this change would disable auto-healing of `so`). |
| 320 | |
| 321 | .. code-block:: yaml |
| 322 | |
| 323 | ################################################################# |
| 324 | # Global configuration overrides. |
| 325 | # |
| 326 | # These overrides will affect all helm charts (ie. applications) |
| 327 | # that are listed below and are 'enabled'. |
| 328 | ################################################################# |
| 329 | global: |
| 330 | <...> |
| 331 | |
| 332 | ################################################################# |
| 333 | # Enable/disable and configure helm charts (ie. applications) |
| 334 | # to customize the ONAP deployment. |
| 335 | ################################################################# |
| 336 | aaf: |
| 337 | enabled: false |
| 338 | <...> |
| 339 | so: # Service Orchestrator |
| 340 | enabled: true |
| 341 | |
| 342 | replicaCount: 1 |
| 343 | |
| 344 | liveness: |
| 345 | # necessary to disable liveness probe when setting breakpoints |
| 346 | # in debugger so K8s doesn't restart unresponsive container |
| 347 | enabled: true |
| 348 | |
| 349 | <...> |
| 350 | |
Roger Maitland | da22158 | 2018-05-10 13:43:58 -0400 | [diff] [blame] | 351 | Accessing the ONAP Portal using OOM and a Kubernetes Cluster |
| 352 | ------------------------------------------------------------ |
| 353 | |
| 354 | The ONAP deployment created by OOM operates in a private IP network that isn't |
| 355 | publicly accessible (i.e. Openstack VMs with private internal network) which |
| 356 | blocks access to the ONAP Portal. To enable direct access to this Portal from a |
| 357 | user's own environment (a laptop etc.) the portal application's port 8989 is |
| 358 | exposed through a `Kubernetes LoadBalancer`_ object. |
| 359 | |
| 360 | Typically, to be able to access the Kubernetes nodes publicly a public address is |
| 361 | assigned. In Openstack this is a floating IP address. |
| 362 | |
| 363 | When the `portal-app` chart is deployed a Kubernetes service is created that |
| 364 | instantiates a load balancer. The LB chooses the private interface of one of |
| 365 | the nodes as in the example below (10.0.0.4 is private to the K8s cluster only). |
| 366 | Then to be able to access the portal on port 8989 from outside the K8s & |
| 367 | Openstack environment, the user needs to assign/get the floating IP address that |
| 368 | corresponds to the private IP as follows:: |
| 369 | |
| 370 | > kubectl -n onap get services|grep "portal-app" |
| 371 | 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 |
| 372 | |
| 373 | |
| 374 | In this example, use the 10.0.0.4 private address as a key find the |
| 375 | corresponding public address which in this example is 10.12.6.155. If you're |
| 376 | using OpenStack you'll do the lookup with the horizon GUI or the Openstack CLI |
| 377 | for your tenant (openstack server list). That IP is then used in your |
| 378 | `/etc/hosts` to map the fixed DNS aliases required by the ONAP Portal as shown |
| 379 | below:: |
| 380 | |
| 381 | 10.12.6.155 portal.api.simpledemo.onap.org |
| 382 | 10.12.6.155 vid.api.simpledemo.onap.org |
| 383 | 10.12.6.155 sdc.api.fe.simpledemo.onap.org |
| 384 | 10.12.6.155 portal-sdk.simpledemo.onap.org |
| 385 | 10.12.6.155 policy.api.simpledemo.onap.org |
| 386 | 10.12.6.155 aai.api.sparky.simpledemo.onap.org |
| 387 | 10.12.6.155 cli.api.simpledemo.onap.org |
| 388 | 10.12.6.155 msb.api.discovery.simpledemo.onap.org |
| 389 | |
| 390 | Ensure you've disabled any proxy settings the browser you are using to access |
| 391 | the portal and then simply access the familiar URL: |
| 392 | http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm |
| 393 | |
| 394 | .. note:: Alternatives Considered. |
| 395 | |
| 396 | Kubernetes port forwarding was considered but discarded as it would require |
| 397 | the end user to run a script that opens up port forwarding tunnels to each of |
| 398 | the pods that provides a portal application widget. |
| 399 | |
| 400 | Reverting to a VNC server similar to what was deployed in the Amsterdam |
| 401 | release was also considered but there were many issues with resolution, lack |
| 402 | of volume mount, /etc/hosts dynamic update, file upload that were a tall order |
| 403 | to solve in time for the Beijing release. |
| 404 | |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 405 | .. figure:: oomLogoV2-Monitor.png |
| 406 | :align: right |
| 407 | |
| 408 | Monitor |
| 409 | ======= |
| 410 | |
| 411 | All highly available systems include at least one facility to monitor the |
| 412 | health of components within the system. Such health monitors are often used as |
| 413 | inputs to distributed coordination systems (such as etcd, zookeeper, or consul) |
| 414 | and monitoring systems (such as nagios or zabbix). OOM provides two mechanims |
| 415 | to monitor the real-time health of an ONAP deployment: |
| 416 | |
| 417 | - a Consul GUI for a human operator or downstream monitoring systems and |
| 418 | Kubernetes liveness probes that enable automatic healing of failed |
| 419 | containers, and |
| 420 | - a set of liveness probes which feed into the Kubernetes manager which |
| 421 | are described in the Heal section. |
| 422 | |
Gildas Lanilis | 64d17ae | 2018-05-18 16:58:05 -0700 | [diff] [blame] | 423 | Within ONAP, Consul is the monitoring system of choice and deployed by OOM in two parts: |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 424 | |
| 425 | - a three-way, centralized Consul server cluster is deployed as a highly |
Gildas Lanilis | 64d17ae | 2018-05-18 16:58:05 -0700 | [diff] [blame] | 426 | available monitor of all of the ONAP components, and |
Roger Maitland | 953b5f1 | 2018-03-22 15:24:04 -0400 | [diff] [blame] | 427 | - a number of Consul agents. |
| 428 | |
| 429 | The Consul server provides a user interface that allows a user to graphically |
| 430 | view the current health status of all of the ONAP components for which agents |
| 431 | have been created - a sample from the ONAP Integration labs follows: |
| 432 | |
| 433 | .. figure:: consulHealth.png |
| 434 | :align: center |
| 435 | |
| 436 | To see the real-time health of a deployment go to: http://<kubernetes IP>:30270/ui/ |
| 437 | where a GUI much like the following will be found: |
| 438 | |
| 439 | |
| 440 | .. figure:: oomLogoV2-Heal.png |
| 441 | :align: right |
| 442 | |
| 443 | Heal |
| 444 | ==== |
| 445 | |
| 446 | The ONAP deployment is defined by Helm charts as mentioned earlier. These Helm |
| 447 | charts are also used to implement automatic recoverability of ONAP components |
| 448 | when individual components fail. Once ONAP is deployed, a "liveness" probe |
| 449 | starts checking the health of the components after a specified startup time. |
| 450 | |
| 451 | Should a liveness probe indicate a failed container it will be terminated and a |
| 452 | replacement will be started in its place - containers are ephemeral. Should the |
| 453 | deployment specification indicate that there are one or more dependencies to |
| 454 | this container or component (for example a dependency on a database) the |
| 455 | dependency will be satisfied before the replacement container/component is |
| 456 | started. This mechanism ensures that, after a failure, all of the ONAP |
| 457 | components restart successfully. |
| 458 | |
| 459 | To test healing, the following command can be used to delete a pod:: |
| 460 | |
| 461 | > kubectl delete pod [pod name] -n [pod namespace] |
| 462 | |
| 463 | One could then use the following command to monitor the pods and observe the |
| 464 | pod being terminated and the service being automatically healed with the |
| 465 | creation of a replacement pod:: |
| 466 | |
| 467 | > kubectl get pods --all-namespaces -o=wide |
| 468 | |
| 469 | .. figure:: oomLogoV2-Scale.png |
| 470 | :align: right |
| 471 | |
| 472 | Scale |
| 473 | ===== |
| 474 | |
| 475 | Many of the ONAP components are horizontally scalable which allows them to |
| 476 | adapt to expected offered load. During the Beijing release scaling is static, |
| 477 | that is during deployment or upgrade a cluster size is defined and this cluster |
| 478 | will be maintained even in the presence of faults. The parameter that controls |
| 479 | the cluster size of a given component is found in the values.yaml file for that |
| 480 | component. Here is an excerpt that shows this parameter: |
| 481 | |
| 482 | .. code-block:: yaml |
| 483 | |
| 484 | # default number of instances |
| 485 | replicaCount: 1 |
| 486 | |
| 487 | In order to change the size of a cluster, an operator could use a helm upgrade |
| 488 | (described in detail in the next section) as follows:: |
| 489 | |
| 490 | > helm upgrade --set replicaCount=3 onap/so/mariadb |
| 491 | |
| 492 | The ONAP components use Kubernetes provided facilities to build clustered, |
| 493 | highly available systems including: Services_ with load-balancers, ReplicaSet_, |
| 494 | and StatefulSet_. Some of the open-source projects used by the ONAP components |
| 495 | directly support clustered configurations, for example ODL and MariaDB Galera. |
| 496 | |
| 497 | The Kubernetes Services_ abstraction to provide a consistent access point for |
| 498 | each of the ONAP components, independent of the pod or container architecture |
| 499 | of that component. For example, SDN-C uses OpenDaylight clustering with a |
| 500 | default cluster size of three but uses a Kubernetes service to and change the |
| 501 | number of pods in this abstract this cluster from the other ONAP components |
| 502 | such that the cluster could change size and this change is isolated from the |
| 503 | other ONAP components by the load-balancer implemented in the ODL service |
| 504 | abstraction. |
| 505 | |
| 506 | A ReplicaSet_ is a construct that is used to describe the desired state of the |
| 507 | cluster. For example 'replicas: 3' indicates to Kubernetes that a cluster of 3 |
| 508 | instances is the desired state. Should one of the members of the cluster fail, |
| 509 | a new member will be automatically started to replace it. |
| 510 | |
| 511 | Some of the ONAP components many need a more deterministic deployment; for |
| 512 | example to enable intra-cluster communication. For these applications the |
| 513 | component can be deployed as a Kubernetes StatefulSet_ which will maintain a |
| 514 | persistent identifier for the pods and thus a stable network id for the pods. |
| 515 | For example: the pod names might be web-0, web-1, web-{N-1} for N 'web' pods |
| 516 | with corresponding DNS entries such that intra service communication is simple |
| 517 | even if the pods are physically distributed across multiple nodes. An example |
| 518 | of how these capabilities can be used is described in the Running Consul on |
| 519 | Kubernetes tutorial. |
| 520 | |
| 521 | .. figure:: oomLogoV2-Upgrade.png |
| 522 | :align: right |
| 523 | |
| 524 | Upgrade |
| 525 | ======= |
| 526 | |
| 527 | Helm has built-in capabilities to enable the upgrade of pods without causing a |
| 528 | loss of the service being provided by that pod or pods (if configured as a |
| 529 | cluster). As described in the OOM Developer's Guide, ONAP components provide |
| 530 | an abstracted 'service' end point with the pods or containers providing this |
| 531 | service hidden from other ONAP components by a load balancer. This capability |
| 532 | is used during upgrades to allow a pod with a new image to be added to the |
| 533 | service before removing the pod with the old image. This 'make before break' |
| 534 | capability ensures minimal downtime. |
| 535 | |
| 536 | Prior to doing an upgrade, determine of the status of the deployed charts:: |
| 537 | |
| 538 | > helm list |
| 539 | NAME REVISION UPDATED STATUS CHART NAMESPACE |
| 540 | so 1 Mon Feb 5 10:05:22 2018 DEPLOYED so-2.0.1 default |
| 541 | |
| 542 | When upgrading a cluster a parameter controls the minimum size of the cluster |
| 543 | during the upgrade while another parameter controls the maximum number of nodes |
| 544 | in the cluster. For example, SNDC configured as a 3-way ODL cluster might |
| 545 | require that during the upgrade no fewer than 2 pods are available at all times |
| 546 | to provide service while no more than 5 pods are ever deployed across the two |
| 547 | versions at any one time to avoid depleting the cluster of resources. In this |
| 548 | scenario, the SDNC cluster would start with 3 old pods then Kubernetes may add |
| 549 | a new pod (3 old, 1 new), delete one old (2 old, 1 new), add two new pods (2 |
| 550 | old, 3 new) and finally delete the 2 old pods (3 new). During this sequence |
| 551 | the constraints of the minimum of two pods and maximum of five would be |
| 552 | maintained while providing service the whole time. |
| 553 | |
| 554 | Initiation of an upgrade is triggered by changes in the Helm charts. For |
| 555 | example, if the image specified for one of the pods in the SDNC deployment |
| 556 | specification were to change (i.e. point to a new Docker image in the nexus3 |
| 557 | repository - commonly through the change of a deployment variable), the |
| 558 | sequence of events described in the previous paragraph would be initiated. |
| 559 | |
| 560 | For example, to upgrade a container by changing configuration, specifically an |
| 561 | environment value:: |
| 562 | |
| 563 | > helm upgrade beijing onap/so --version 2.0.1 --set enableDebug=true |
| 564 | |
| 565 | Issuing this command will result in the appropriate container being stopped by |
| 566 | Kubernetes and replaced with a new container with the new environment value. |
| 567 | |
| 568 | To upgrade a component to a new version with a new configuration file enter:: |
| 569 | |
| 570 | > helm upgrade beijing onap/so --version 2.0.2 -f environments/demo.yaml |
| 571 | |
| 572 | To fetch release history enter:: |
| 573 | |
| 574 | > helm history so |
| 575 | REVISION UPDATED STATUS CHART DESCRIPTION |
| 576 | 1 Mon Feb 5 10:05:22 2018 SUPERSEDED so-2.0.1 Install complete |
| 577 | 2 Mon Feb 5 10:10:55 2018 DEPLOYED so-2.0.2 Upgrade complete |
| 578 | |
| 579 | Unfortunately, not all upgrades are successful. In recognition of this the |
| 580 | lineup of pods within an ONAP deployment is tagged such that an administrator |
| 581 | may force the ONAP deployment back to the previously tagged configuration or to |
| 582 | a specific configuration, say to jump back two steps if an incompatibility |
| 583 | between two ONAP components is discovered after the two individual upgrades |
| 584 | succeeded. |
| 585 | |
| 586 | This rollback functionality gives the administrator confidence that in the |
| 587 | unfortunate circumstance of a failed upgrade the system can be rapidly brought |
| 588 | back to a known good state. This process of rolling upgrades while under |
| 589 | service is illustrated in this short YouTube video showing a Zero Downtime |
| 590 | Upgrade of a web application while under a 10 million transaction per second |
| 591 | load. |
| 592 | |
| 593 | For example, to roll-back back to previous system revision enter:: |
| 594 | |
| 595 | > helm rollback so 1 |
| 596 | |
| 597 | > helm history so |
| 598 | REVISION UPDATED STATUS CHART DESCRIPTION |
| 599 | 1 Mon Feb 5 10:05:22 2018 SUPERSEDED so-2.0.1 Install complete |
| 600 | 2 Mon Feb 5 10:10:55 2018 SUPERSEDED so-2.0.2 Upgrade complete |
| 601 | 3 Mon Feb 5 10:14:32 2018 DEPLOYED so-2.0.1 Rollback to 1 |
| 602 | |
| 603 | .. note:: |
| 604 | |
| 605 | The description field can be overridden to document actions taken or include |
| 606 | tracking numbers. |
| 607 | |
| 608 | Many of the ONAP components contain their own databases which are used to |
| 609 | record configuration or state information. The schemas of these databases may |
| 610 | change from version to version in such a way that data stored within the |
| 611 | database needs to be migrated between versions. If such a migration script is |
| 612 | available it can be invoked during the upgrade (or rollback) by Container |
| 613 | Lifecycle Hooks. Two such hooks are available, PostStart and PreStop, which |
| 614 | containers can access by registering a handler against one or both. Note that |
| 615 | it is the responsibility of the ONAP component owners to implement the hook |
| 616 | handlers - which could be a shell script or a call to a specific container HTTP |
| 617 | endpoint - following the guidelines listed on the Kubernetes site. Lifecycle |
| 618 | hooks are not restricted to database migration or even upgrades but can be used |
| 619 | anywhere specific operations need to be taken during lifecycle operations. |
| 620 | |
| 621 | OOM uses Helm K8S package manager to deploy ONAP components. Each component is |
| 622 | arranged in a packaging format called a chart - a collection of files that |
| 623 | describe a set of k8s resources. Helm allows for rolling upgrades of the ONAP |
| 624 | component deployed. To upgrade a component Helm release you will need an |
| 625 | updated Helm chart. The chart might have modified, deleted or added values, |
| 626 | deployment yamls, and more. To get the release name use:: |
| 627 | |
| 628 | > helm ls |
| 629 | |
| 630 | To easily upgrade the release use:: |
| 631 | |
| 632 | > helm upgrade [RELEASE] [CHART] |
| 633 | |
| 634 | To roll back to a previous release version use:: |
| 635 | |
| 636 | > helm rollback [flags] [RELEASE] [REVISION] |
| 637 | |
| 638 | For example, to upgrade the onap-so helm release to the latest SO container |
| 639 | release v1.1.2: |
| 640 | |
| 641 | - Edit so values.yaml which is part of the chart |
| 642 | - Change "so: nexus3.onap.org:10001/openecomp/so:v1.1.1" to |
| 643 | "so: nexus3.onap.org:10001/openecomp/so:v1.1.2" |
| 644 | - From the chart location run:: |
| 645 | |
| 646 | > helm upgrade onap-so |
| 647 | |
| 648 | The previous so pod will be terminated and a new so pod with an updated so |
| 649 | container will be created. |
| 650 | |
| 651 | .. figure:: oomLogoV2-Delete.png |
| 652 | :align: right |
| 653 | |
| 654 | Delete |
| 655 | ====== |
| 656 | |
| 657 | Existing deployments can be partially or fully removed once they are no longer |
| 658 | needed. To minimize errors it is recommended that before deleting components |
| 659 | from a running deployment the operator perform a 'dry-run' to display exactly |
| 660 | what will happen with a given command prior to actually deleting anything. For |
| 661 | example:: |
| 662 | |
| 663 | > helm delete --dry-run beijing |
| 664 | |
| 665 | will display the outcome of deleting the 'beijing' release from the deployment. |
| 666 | To completely delete a release and remove it from the internal store enter:: |
| 667 | |
| 668 | > helm delete --purge beijing |
| 669 | |
| 670 | One can also remove individual components from a deployment by changing the |
| 671 | ONAP configuration values. For example, to remove `so` from a running |
| 672 | deployment enter:: |
| 673 | |
| 674 | > helm upgrade beijing osn/onap --set so.enabled=false |
| 675 | |
| 676 | will remove `so` as the configuration indicates it's no longer part of the |
| 677 | deployment. This might be useful if a one wanted to replace just `so` by |
| 678 | installing a custom version. |