246c61deac822650129de8ee68468f1ef9df9c95
[so.git] / docs / developer_info / Working_with_so_monitoring.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2017 Huawei Technologies Co., Ltd.
4 .. Modifications Copyright (c) 2020 Nokia
5
6 Working with SO Monitoring
7 ==========================
8
9 Starting from Guilin release SO Monitoring uses https and NodePort service during communication with operator.
10 Certificates used for communication are generated automatically using AAF and certInitializer, when SO Monitoring 
11 is deployed using OOM. For that reason, no additional tasks are needed in order to access the SO Monitoring ui, 
12 when the SO is fully deployed. 
13
14 SO Monitoring contains also pre-installed certs which can be used in local development environment. **They are 
15 for development purpose only!**
16
17 1. Credentials to login and initial setup
18 ---------------------------------------------
19
20 Defalut credentials and certs of SO Monitoring, if you want to develop SO Monitoring out of ONAP cluster,
21 are stored in the app. Credentials are as follows:
22
23 .. code-block:: bash
24
25  spring:
26    main:
27      allow-bean-definition-overriding: true
28    security:
29      usercredentials:
30      -                                         
31        username: demo
32        password: '$2a$10$ndkDhATUid4a3g0JJVRv2esX4rtB.vzCn7iBhKyR1qZ/wDdvNzjTS'
33        role: GUI-Client
34
35 Username - demo. Password (**demo123456!**) is bcrypted.
36
37
38 This setup is overridden by the override.yaml file which is stored in the OOM project.
39 Override.yaml file can be edited directly in case of local ONAP setup. This file is loaded into
40 container through configmap.
41
42 .. note::
43  If you want to change config stored in override.yaml on working deployment, you have to edit k8s
44  configmap. Due to insufficient permissions it is not possible directly in the container. After that pod have 
45  to be restarted.
46
47 .. code-block:: bash
48  kubectl -n onap edit configmap dev-so-monitoring-app-configmap
49
50 .. image:: ../images/configmap.png
51
52 Special care needs to be given to the indentation. Spring needs to be inline with the mso already present and others
53 added accordingly.
54
55 .. warning::
56 Attention! The default setup of the OOM makes SO Monitoring password is being automatically generated during ONAP
57 deployment and injected through k8s secret
58
59 2. Setup, retrieve and edit default SO Monitoring password
60 ----------------------------------------------------------
61
62 Automatic generation of password for SO Monitoring during ONAP deployment can be overriden. In result, password 
63 can be set up manually. Such case requires to edit ONAP config file, template of which is stored in  
64 **oom/kubernetes/onap/values.yaml** file. 
65
66 .. image:: ../images/so-monitoring-config.png
67
68 Following lines presented in fig. has to be uncommented.
69
70 If customized file is used, following code has to be paste under the SO config (be aware of indentation):
71
72 .. code-block:: bash
73
74  so:
75    ...
76    so-monitoring:
77      server:
78        monitoring:
79          password: demo123456!
80    ...
81
82 Alternative way (**not recommended**) is to add password entry in the **oom/kubernetes/so/components/so-monitoring/values.yaml**
83
84 .. code-block:: bash
85
86  ...
87  server:
88    monitoring:
89      password: demo123456!
90  ...
91
92 To retrieve actual password for SO Monitoring on existing ONAP install, run the following command:
93
94 .. code-block:: bash
95
96  kubectl get secret -n onap dev-so-monitoring-app-user-creds -o json | jq -r .data.password | base64 --decode
97
98 .. image:: ../images/so-monitoring-password.png
99
100 To change actual password on existing ONAP install, **dev-so-monitoring-app-user-creds** secret has to be modified.
101
102 .. code-block:: bash
103
104  kubectl edit secret -n onap dev-so-monitoring-app-user-creds
105
106 .. image:: ../images/so-monitoring-secret.png
107
108 Edit password entry, which has to be given in base64 form. Base64 form of password can be obtained by running:
109
110 .. code-block:: bash
111  
112  echo 'YOUR_PASSWORD' | base64
113
114 .. image:: ../images/so-monitorring-base64-password.png
115
116 Once, password was edited, pod has to be restarted.
117
118
119 3. Login to SO Monitoring
120 -------------------------
121
122 Identify the external port which is mapped to SO Monitoring using the following command. The default port is 30224 :
123
124 .. code-block:: bash
125
126  sudo kubectl -n onap get svc | grep so-monitoring
127
128 .. image:: ../images/nodemap.png
129
130 Then access the UI of SO Monitoring, by default https://<k8s-worker-ip>:30224/
131
132 .. image:: ../images/ui.png
133
134 4. Hiding the SO Monitoring service (ClusterIP)
135 ---------------------------------------
136
137 The SO Monitoring service is set to the NodePort type. It is used to expose the service at a static port.
138 Hence there is possibility to contact the NodePort Service, from outside cluster, by requesting <NodeIP>:<NodePort>.
139
140 In order to make the service only reachable from within the cluster, ClusterIP service has to be set.
141
142 Command used to edit the service configuration of SO Monitoring is:
143
144 .. code-block:: bash
145
146  sudo kubectl edit svc so-monitoring -n onap
147
148 .. image:: ../images/nodeport.png