a4cb085c12a61bfd7421c8b04aee147232688c42
[ric-plt/ric-dep.git] / new-installer / README.md
1 # Overview
2
3 **Note: This is WIP so your mileage may vary, but you are welcome to create an issue if there are problems you are facing using this documentation.**
4
5 This directory contains the source code for the new installer for the NearRT RIC Platform. The new installer leverages a single helm chart for installation. The components deployed during installations are determined by various flags present in the `values.yaml` file of the chart, which can be overridden using an override file.
6
7 The code is organized as follows
8
9   |
10   + helm
11   | |
12   | + charts
13   |   |
14   |   + Makefile
15   |   + nearrtric/
16   |     |
17   |     + Makefile
18   |     + a1mediator/
19   |     + appmgr/
20   |     + dbaas/
21   |     + e2mgr/
22   |     + e2term/
23   |     + nearrt-ric-common/
24         |               ...
25   |
26   + helm-overrides/
27     |
28     + nearrtric/
29       |
30       + example-override-file.yaml
31
32 # Supported Versions
33
34 Following software versions are currently supported.
35
36   - `minikube` with supported `k8s` version.
37   - kubernetes 1.22 and above. A number of API versions were deprecated starting from this version. This should thus serve as a good
38   - Helm Charts version 3
39
40 This setup is tested on Ubuntu 22.04 with following `minikube`, `k8s`, `kubectl` and `helm` versions.
41
42 ```bash
43 $ uname -mvp
44 #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64
45
46 $ kubectl version
47 WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
48 Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.1", GitCommit:"3ddd0f45aa91e2f30c70734b175631bec5b5825a", GitTreeState:"clean", BuildDate:"2022-05-24T12:26:19Z", GoVersion:"go1.18.2", Compiler:"gc", Platform:"linux/amd64"}
49 Kustomize Version: v4.5.4
50 Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.1", GitCommit:"8f94681cd294aa8cfd3407b8191f6c70214973a4", GitTreeState:"clean", BuildDate:"2023-01-18T15:51:25Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"}
51 WARNING: version difference between client (1.24) and server (1.26) exceeds the supported minor version skew of +/-1
52
53 $ minikube version
54 minikube version: v1.29.0
55 commit: ddac20b4b34a9c8c857fc602203b6ba2679794d3
56
57 $ helm version
58 version.BuildInfo{Version:"v3.11.2", GitCommit:"912ebc1cd10d38d340f048efaf0abda047c3468e", GitTreeState:"clean", GoVersion:"go1.18.10"}
59
60 ```
61
62 # Getting Started
63
64 ## Setup and Pre-requisites
65
66 These instructions assume that you have `minikube` and `kubectl` installed.
67
68 ## Starting `minikube`
69
70 First start `minikube` using the following command.
71
72 ```bash
73 $ minikube start --driver=docker
74
75 ```
76 We are using the 'docker' driver because this allows us to set up tunnels and expose services to the host using the Kubernetes Ingress Controller. The other drivers may also work but are not tested so far. This will start the 'minikube kubernetes cluster'. You can interact with this cluster using `kubectl`.
77
78 Also, note that you may have to set the environment variables like `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` if you are behind an HTTP Proxy. Otherwise Kubernetes won't be able to pull the images.
79
80 ```bash
81 $ kubectl get pods -A
82 ```
83
84 ## Creating Platform and Xapp Namespaces
85
86 After this step we need to create the namespaces for our deployment. Note: The namespaces need to be created every time we create a new cluster (not upon restarting the cluster).
87
88 ```bash
89 $ kubectl create ns ricplt
90 $ kubectl create ns ricxapp
91 ```
92
93 This sets up the cluster for subsequent installation of the NearRT RIC platform components.
94
95 ## Installing and Running Chart Museum
96
97 One current limitation of this installation is - the XApp on-boarding functionality is not fully integrated into the `k8s` deployment as a result following steps need to be run manually for on-boarding and  creating installation packages of XApps. This will be eventually part of the `k8s` deployment (likely as a separate `helm` chart deployed in a separate namespace `k8s`).
98
99 Please follow the steps mentioned below to install `helm`, `chartmuseum` and `cm-push` plugin for `helm`.
100
101 ```bash
102 # Following commands are run as non root user. The idea is to keep the privileges to minimum.
103
104 # Create a `temp/` directory in the home folder that will be used to download all the artifacts required during the bring up.
105 $ mkdir temp
106 $ cd temp
107 $ wget https://get.helm.sh/helm-v3.11.2-linux-amd64.tar.gz
108 $ wget https://get.helm.sh/chartmuseum-v0.13.1-linux-amd64.tar.gz
109 $ tar xvzpf helm-v3.11.2-linux-amd64.tar.gz
110 $ tar xvzpf chartmuseum-v0.13.1-linux-amd64.tar.gz
111
112 # It is assumed that ~/bin/ is in your $PATH
113 $ cp linux-amd64/chartmuseum linux-amd64/helm ~/bin
114 $ helm version
115 $ chartmuseum -version
116
117 # To Push to chart museum, we will need to install a Chart Museum push plugin.
118 $ helm plugin install https://github.com/chartmuseum/helm-push
119
120 # This should have the `cm-push` command available.
121 $ helm plugin list
122 NAME    VERSION DESCRIPTION
123 cm-push 0.10.3  Push chart package to ChartMuseum
124 ```
125
126 Run the following command to run Chart museum.
127
128 ```bash
129 # This step is fairly simple, simply run the chartmusem command with appropriate options
130 # We are using local storage backend and port 6873 (MUSE) and a directory called `helm/chartmuseum/`
131 # The setup is kept simple.
132 $ chartmuseum --debug --port 6873 --storage local --storage-local-rootdir $HOME/helm/chartsmuseum/
133 ```
134
135 ## Setting up Helm Repositories
136
137 ### Setting up `local` Helm Repo
138
139 We will be building the `helm` charts locally and those charts will be 'push'ed to the local repository. Later during installations charts will be downloaded from this `local` repository. The `chartmuseum` server described above will serve this 'local' repository.
140
141 ```bash
142 $ helm repo add local http://localhost:6873/
143 $ helm repo list
144 ```
145 ### Setting up Third Party repositories
146
147 This installation leverages the chart available from the third-party repositories, instead of maintaining those charts ourselves. This allows us to update third party dependencies easily and we don't need to maintain our own 'charts' just for this alone.
148
149 For the installation of the Near RT RIC, we are making use of `influxdb2` (for storing KPI data by `kpimon-go` application). The charts for `influxdb2` are available from the Influxdata repository. Hence this repository needs to be added inside `helm`.
150
151 ```bash
152 $ helm repo add influxdata https://helm.influxdata.com
153 $ helm repo list
154 ```
155
156
157 ## Running Near RT RIC
158
159 ### Preparing the Charts
160
161 We will first build the charts based on the data from this repository. We use `make` for building the charts. To build the charts, following instructions can be followed.
162
163 ```bash
164 # Make sure that chart museum is running already as discussed above
165 #
166 # First we will prepare chart(s) for the installation. This is done using Makefile
167 # `make` tool needs to be installed for this.
168 $ cd helm/charts
169 $ make nearrtric
170
171 ##### Output ignored
172
173 $ helm search repo local/nearrtric
174 NAME            CHART VERSION   APP VERSION     DESCRIPTION
175 local/nearrtric 0.1.0                           Umbrella Helm Chart for NearRT RAN Intelligent ...
176 ```
177 This means the `local/nearrtric` chart is available and can be installed using `helm install`.
178
179
180 ### Installing the Charts
181
182 Currently, the Near RT RIC contains mandatory components and some optional components. Following are mandatory components -
183
184 1. `appmgr`
185 2. `dbaas`
186 3. `e2mgr`
187 4. `e2term`
188 5. `submgr`
189 6. `rtmgr`
190
191 and following are optional components -
192
193 1. `a1mediator`
194 2. `alarmmanager`
195 3. `jaegeradapter`
196 4. `o1mediator`
197 5. `vespamgr`
198 6. `xapp-onboarder`
199
200 and following are third party (optional) components -
201
202 1. `influxdb2`
203
204 The default `values.yaml` file disables all optional components. The optional components can be enabled using the override file inside `helm-overrides/nearrtric/` directory. The provided file enables `influxdb2` and `a1mediator` optional components. In addition, additional configurations like using docker image etc can be changed for all the components. Please refer to the provided example file for the supported configurations.
205
206 Run the following command to install the chart.
207
208 ```bash
209 $ helm install nearrtric -n ricplt local/nearrtric -f example_recipe_latest_stable.yaml
210 ```
211 Note: You can refer to `helm-overrides/nearrtric/minimal-nearrt-ric.yaml` file and follow the conventions used in this override file.
212
213 This should install the main `nearrtric` chart and it's dependencies. The installation can be verified using the following `kubectl` commands.
214
215 ```bash
216 $ kubectl get pods -n ricplt
217 NAME                                              READY   STATUS    RESTARTS        AGE
218 deployment-ricplt-a1mediator-84fc865778-x846h     1/1     Running   1 (4m13s ago)   5m16s
219 deployment-ricplt-appmgr-57cc4d665b-lb8dg         1/1     Running   0               5m16s
220 deployment-ricplt-e2mgr-9748f9585-mg2zl           1/1     Running   3 (4m47s ago)   5m16s
221 deployment-ricplt-e2term-alpha-5ffb57bf9f-slmrz   1/1     Running   0               5m16s
222 deployment-ricplt-rtmgr-57f7c7797f-mpkg9          1/1     Running   0               5m16s
223 deployment-ricplt-submgr-74f67bf444-qh5rn         1/1     Running   0               5m16s
224 ricplt-influxdb-0                                 1/1     Running   0               5m16s
225 statefulset-ricplt-dbaas-server-0                 1/1     Running   0               5m16s
226
227 $ kubectl get svc -n ricplt
228 NAME                                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)              AGE
229 ricplt-influxdb                          ClusterIP   10.105.150.100   <none>        8086/TCP             6m
230 service-ricplt-a1mediator-http           ClusterIP   10.101.218.159   <none>        10000/TCP            6m1s
231 service-ricplt-a1mediator-rmr            ClusterIP   10.103.242.185   <none>        4561/TCP,4562/TCP    6m1s
232 service-ricplt-appmgr-http               ClusterIP   10.111.10.61     <none>        8080/TCP             6m1s
233 service-ricplt-appmgr-rmr                ClusterIP   10.105.106.102   <none>        4561/TCP,4560/TCP    6m1s
234 service-ricplt-dbaas-tcp                 ClusterIP   None             <none>        6379/TCP             6m1s
235 service-ricplt-e2mgr-http                ClusterIP   10.97.133.251    <none>        3800/TCP             6m1s
236 service-ricplt-e2mgr-rmr                 ClusterIP   10.108.221.142   <none>        4561/TCP,3801/TCP    6m1s
237 service-ricplt-e2term-prometheus-alpha   ClusterIP   10.109.194.105   <none>        8088/TCP             6m1s
238 service-ricplt-e2term-rmr-alpha          ClusterIP   10.109.22.225    <none>        4561/TCP,38000/TCP   6m
239 service-ricplt-e2term-sctp-alpha         NodePort    10.96.249.236    <none>        36422:32222/SCTP     6m
240 service-ricplt-rtmgr-http                ClusterIP   10.96.22.95      <none>        3800/TCP             6m
241 service-ricplt-rtmgr-rmr                 ClusterIP   10.99.242.83     <none>        4561/TCP,4560/TCP    6m
242 service-ricplt-submgr-http               ClusterIP   10.105.226.85    <none>        8088/TCP             6m
243 service-ricplt-submgr-rmr                ClusterIP   10.96.246.248    <none>        4560/TCP,4561/TCP    6m
244 ```
245
246 ### Deploying the Simulator
247
248 You can test the installed Near RT RIC by installing the simulator from the [sim-e2-interface](https://gerrit.o-ran-sc.org/r/admin/repos/sim/e2-interface,general) repository. If you are installing on Ubuntu 22.04, The image needs to be built using the Ubuntu 22.04 Builder Image. Change the appropriate lines in the `Dockerfile` in the directory `e2sim/e2sm_examples/kpm_e2sm`. The Ubuntu 22.04 Builder image can be used as follows
249
250 ```bash
251
252  # the builder has: git, wget, cmake, gcc/g++, make, python2/3. v7 dropped nng support
253  #
254 -ARG CONTAINER_PULL_REGISTRY=nexus3.o-ran-sc.org:10001
255 -FROM ${CONTAINER_PULL_REGISTRY}/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as buildenv
256 +ARG CONTAINER_PULL_REGISTRY=nexus3.o-ran-sc.org:10004
257 +# FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubunut22-c-go:0.1.0 as buildenv
258 +FROM ${CONTAINER_PULL_REGISTRY}/o-ran-sc/bldr-ubuntu22-c-go:0.1.0 as buildenv
259
260 ```
261
262 It is also required to update the IP Address of the `service-ricplt-e2term-sctp-alpha` service above in the `Dockerfile`. (Agreed this is a bit ugly and will be fixed soon!).
263
264 ```bash
265 -CMD kpm_sim 10.110.102.29 36422
266 +CMD kpm_sim 10.96.249.236 36422
267 ```
268 The Docker Image that needs to be built should be using the 'docker environment' of the `minikube`. This environment can be set by running the following command.
269
270 ```bash
271 ```
272
273 The simulator then can be started as follows
274
275 ```bash
276
277 # Setup the 'docker env'
278 $ eval $(minikube -p minikube docker-env)
279
280 # Build docker image
281 $ docker build -t e2sim:latest .
282
283 # Make sure the `helm/deployments/deployment.yaml` file points to `e2sim:latest` images
284
285 $ helm install e2sim -n ricplt helm/
286
287 ```
288
289 ### Deploying XApps
290
291 You can deploy the XApps. The approach we follow is preparing the chart images for the XApps first and then simply using `helm install`. The Chart images can be prepared by using the Xapp Onboarder. (Note: A future version of deployment would make this available as a single `helm` chart installation, currently this manual step needs to be followed.)
292
293 ```bash
294 $ git clone https://gerrit.o-ran-sc.org/r/ric-plt/appmgr
295 $ cd appmgr/xapp_orchestrater/dev/xapp_onboarder
296
297 # Create a Virtual Environment to install the `xapp_onboarder`
298 $ python3 -m venv venv3
299 $ . venv/bin/activate
300 $ pip install -r requirements.txt
301
302 # Note: The Chart Repo URL points to the `chartmusem` server running started.
303 # Also note the `shcema` typo :-)
304 $ CHART_REPO_URL=http://localhost:6873 dms_cli onboard --config-file-path <path-to-app-config> --shcema_file_path <path-to-schema-json>
305 $ CHART_REPO_URL=http://localhost:6873 dms_cli download_helm_chart <chart-name> <version>
306 # This step downloads the file `chart-name-chart-version.tgz`
307
308 # Finally install the Chart in `ricxapp` namespace
309 $ helm install <release-name> -n ricxapp <chart-name-chart-version.tgz>
310 ```
311
312 You can then check the logs of individual pods using `kubectl logs ...` command to check if the pods, Xapps are running as expected.