1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2017 AT&T Intellectual Property. All rights reserved. Modifications 2020 Nokia Networks
6 Adding a Kubernetes (K8S) Cloud Site to ONAP
7 ============================================
9 The following guide describes how to configure ONAP to be able to instantiate
10 a service in a new cloud site based on Kubernetes.
12 There are three major steps to configure a new k8s cloud site.
14 * Declare the new cloud site within SO
15 * Declare the new cloud site (or new Region Name) in AAI
16 * Multicloud registration and declaration
18 In this guideline the following parameters/values will be used
20 * Complex Name: My_Complex
21 * Region Name: K8S_Cloud_Region_Name
22 * Openstack Tenant Region Value: TenantRegion
23 * Cloud Owner: MyCompanyName
25 STEP 1 : Declare the new cloud site within SO
26 ---------------------------------------------
28 Add new k8s cloud site in mariadb database
29 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 In a Unix Terminal, to get the pod id that is providing
36 kubectl -n onap get pod | grep mariadb-galera
38 To connect to this pod
39 (in this example, the SO pod id is "onap-mariadb-galera-mariadb-galera-0"):
43 kubectl -n onap exec -ti onap-mariadb-galera-mariadb-galera-0 sh
45 Then modify the data in the MariaDB:
49 mysql --user=so_admin --password=so_Admin123
51 INSERT INTO cloud_sites(ID, REGION_ID, IDENTITY_SERVICE_ID, CLOUD_VERSION, CLLI, ORCHESTRATOR) values("K8S_Cloud_Region_Name", "K8S_Cloud_Region_Name", "DEFAULT_KEYSTONE", "2.5", "My_Complex", "multicloud");
53 STEP 2 : Declare the new cloud site in AAI
54 ------------------------------------------
56 Declare a Complex in ONAP AAI
57 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 A Cloud Site is located in a Building called "Complex" object
61 in ONAP AAI datamodel.
63 AAI REST API is used to declare the complex object.
65 Here is an example using "curl" tool to send the API request.
67 The new Complex is named "My_Complex" in this example.
73 https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/complexes/complex/My_Complex \
74 -H 'Accept: application/json' \
75 -H 'Authorization: Basic QUFJOkFBSQ==' \
76 -H 'Cache-Control: no-cache' \
77 -H 'Content-Type: application/json' \
78 -H 'Real-Time: true' \
79 -H 'X-FromAppId: jimmy-postman' \
80 -H 'X-TransactionId: 9999' \
82 "physical-location-id": "My_Complex",
83 "data-center-code": "example-data-center-code-val-5556",
84 "complex-name": "My_Complex",
85 "identity-url": "example-identity-url-val-56898",
86 "physical-location-type": "example-physical-location-type-val-7608",
87 "street1": "example-street1-val-34205",
88 "street2": "example-street2-val-99210",
90 "state": "example-state-val-59487",
91 "postal-code": "100000",
92 "country": "example-country-val-94173",
93 "region": "example-region-val-13893",
94 "latitude": "39.9042",
95 "longitude": "106.4074",
96 "elevation": "example-elevation-val-30253",
97 "lata": "example-lata-val-46073"
101 Check the Complexes in ONAP AAI:
106 https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/complexes \
107 -H 'Accept: application/json' \
108 -H 'Authorization: Basic QUFJOkFBSQ==' \
109 -H 'X-FromAppId: AAI' \
110 -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
111 -H 'cache-control: no-cache' -k
113 Declare a Cloud Site in ONAP AAI
114 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116 To declare a Cloud Site, you need to use the AAI REST API.
118 The new Cloud site is named "K8S_Cloud_Region_Name" in this example.
120 The Cloud Owner is named "MyCompanyName" in this example.
122 parameter "complex-name" relates to the Complex you previously declared.
124 parameter "cloud-type" takes the value "k8s"
126 The following parameters specifying openstack cloud tenant are set with dummy
129 * parameter "cloud-extra-info"
130 * parameter "esr-system-info-list"
132 The association to the complex object is set in the curl request to create the
138 https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/MyCompanyName/K8S_Cloud_Region_Name \
139 -H 'Accept: application/json' \
140 -H 'Authorization: Basic QUFJOkFBSQ==' \
141 -H 'Cache-Control: no-cache' \
142 -H 'Content-Type: application/json' \
143 -H 'Postman-Token: 8b9b95ae-91d6-4436-90fa-69cb4d2db99c' \
144 -H 'Real-Time: true' \
145 -H 'X-FromAppId: jimmy-postman' \
146 -H 'X-TransactionId: 9999' \
148 "cloud-owner": "MyCompanyName",
149 "cloud-region-id": "K8S_Cloud_Region_Name",
151 "owner-defined-type": "t1",
152 "cloud-region-version": "1.0",
153 "complex-name": "My_Complex",
154 "cloud-zone": "CloudZone",
155 "sriov-automation": false,
157 "cloud-extra-info":"{\"openstack-region-id\":\"TenantRegion\"}",
158 "esr-system-info-list": {
161 "esr-system-info-id": "55f97d59-6cc3-49df-8e69-926565f00066",
162 "service-url": "http://10.12.25.2:5000/v3",
164 "password": "onapdemo",
165 "system-type": "VIM",
166 "ssl-insecure": true,
167 "cloud-domain": "Default",
168 "default-tenant": "OOF",
169 "tenant-id": "6bbd2981b210461dbc8fe846df1a7808",
170 "system-status": "active"
174 "relationship-list": {
177 "related-to": "complex",
178 "relationship-label": "org.onap.relationships.inventory.LocatedIn",
179 "related-link": "/aai/v13/cloud-infrastructure/complexes/complex/My_Complex",
180 "relationship-data": [
182 "relationship-key": "complex.physical-location-id",
183 "relationship-value": "My_Complex"
192 Check the Cloud Site creation in ONAP AAI:
197 https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/cloud-regions \
198 -H 'Accept: application/json' \
199 -H 'Authorization: Basic QUFJOkFBSQ==' \
200 -H 'X-FromAppId: AAI' \
201 -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
202 -H 'cache-control: no-cache' -k
204 STEP 3 : Multicloud registration and declaration
205 ------------------------------------------------
207 Register k8s site in multicloud
208 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
210 The k8s site (K8S_Cloud_Region_Name) associated to the cloud owner
211 (MyCompanyName) shall be registered in multicloud.
216 https://msb.api.discovery.simpledemo.onap.org:30283/api/multicloud-titaniumcloud/v1/MyCompanyName/K8S_Cloud_Region_Name/registry \
217 -H 'Accept: application/json' \
218 -H 'Cache-Control: no-cache' \
219 -H 'Content-Type: application/json' -k
222 The registration is successfull if the answer is : 202 Accepted.
224 Looking at the log of windriver multicloud pod, some errors are raised due to
225 the fact that the pod attempts to contact the dummy openstack tenant.
228 kubectl -n onap logs -f onap-multicloud-multicloud-windriver-77dbc6b694-t74qm -c multicloud-windriver
231 Declare k8s connnectivity information in multicloud
232 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237 https://msb.api.discovery.simpledemo.onap.org:30283/api/multicloud-k8s/v1/v1/connectivity-info \
238 -i -F "metadata=<post.json;type=application/json" \
239 -F file=@config/config -k
241 # Content of post.json
243 "cloud-region" : "K8S_Cloud_Region_Name",
244 "cloud-owner" : "MyCompanyName",
245 "other-connectivity-list" : {
249 #config is the .kube/config file of your k8s cloud environment
251 To check that the connectivity information is correctly applied:
256 https://msb.api.discovery.simpledemo.onap.org:30283/api/multicloud-k8s/v1/v1/connectivity-info/K8S_Cloud_Region_Name -k