Commit d9cc9108 authored by garciadeblas's avatar garciadeblas
Browse files

Added test [K8s-01] Creation of Kubernetes cluster from OSM

parent 23944686
Loading
Loading
Loading
Loading
+85 −2
Original line number Diff line number Diff line
@@ -1273,7 +1273,6 @@ NOTE: VNF Metrics collection for scaled instances is not supported.
   osm vnfd-delete slice_basic_middle_vnfd
   ```


### \[SLICING-03\] Advanced Network Slicing

TODO: Under ellaboration. Similar to above, but with day-2 operations
@@ -1282,7 +1281,91 @@ TODO: Under ellaboration. Similar to above, but with day-2 operations

### \[K8s-01\] Creation of Kubernetes cluster from OSM

TODO: Under ellaboration. Deployment of a new Kubernetes cluster from OSM using a NS.
A K8s cluster can be deployed using the following OSM packages:

- [k8s_jujucontroller_vnf](http://osm-download.etsi.org/ftp/Packages/hackfests/k8s_jujucontroller_vnf.tar.gz)
- [k8s_jujumachine_vnf](http://osm-download.etsi.org/ftp/Packages/hackfests/k8s_jujumachine_vnf.tar.gz)
- [k8s_juju](http://osm-download.etsi.org/ftp/Packages/hackfests/k8s_juju_ns.tar.gz)

The NS (k8s_juju) consists of 1 deployer (k8s_jujucontroller_vnf) and 4 nodes (k8s_jujumachine_vnf) connected to a single network or vld (mgmtnet). The deployer is a Kubernetes installer based on Juju: it will configure the other 4 nodes to run a Kubernetes cluster. Behind the scenes, the deployer is a Juju controller where the 4 nodes are manually added to a Juju model, then a juju bundle is deployed on that model.

The following figure illustrates the NS.

![k8s-cluster-with-osm-packages](assets/800px-k8s-cluster-with-osm-packages.png)

The steps to be done are the following:

1. Onboard the packages

   ```bash
   wget http://osm-download.etsi.org/ftp/Packages/hackfests/k8s_jujucontroller_vnf.tar.gz
   wget http://osm-download.etsi.org/ftp/Packages/hackfests/k8s_jujumachine_vnf.tar.gz
   wget http://osm-download.etsi.org/ftp/Packages/hackfests/k8s_juju_ns.tar.gz
   osm nfpkg-create k8s_jujumachine_vnf.tar.gz
   osm nfpkg-create k8s_jujucontroller_vnf.tar.gz
   osm nspkg-create k8s_juju_ns.tar.gz
   ```

2. Instantiation parameters are controlled by `config.yaml`. The relevant parameters are the network in the VIM where the K8s API will eb exposed and where all nodes will be connected (`mgmt` in the example below) and the IP addresses from that network to be assigned to each machine (in the example below, `192.168.0.X`). Create `config.yaml`as follows:

   ```yaml
   ---
   additionalParamsForVnf:
     -
       member-vnf-index: k8s_juju
       additionalParams:
           MACHINE1: "192.168.0.161"
           MACHINE2: "192.168.0.162"
           MACHINE3: "192.168.0.163"
           MACHINE4: "192.168.0.164"
           MACHINE5: ""
           MACHINE6: ""
           MACHINE7: ""
           MACHINE8: ""
           MACHINE9: ""
           MACHINE10: ""
           BUNDLE: ""
   vld:
     -
       name: mgmtnet
       vim-network-name: mgmt              #The network in the VIM to connect all nodes of the clusters
       vnfd-connection-point-ref:
         -
           ip-address: "192.168.0.161"
           member-vnf-index-ref: k8s_vnf1
           vnfd-connection-point-ref: mgmt
         -
           ip-address: "192.168.0.162"
           member-vnf-index-ref: k8s_vnf2
           vnfd-connection-point-ref: mgmt
         -
           ip-address: "192.168.0.163"
           member-vnf-index-ref: k8s_vnf3
           vnfd-connection-point-ref: mgmt
         -
           ip-address: "192.168.0.164"
           member-vnf-index-ref: k8s_vnf4
           vnfd-connection-point-ref: mgmt
         -
           ip-address: "192.168.0.170"
           member-vnf-index-ref: k8s_juju
           vnfd-connection-point-ref: mgmt
   ```

3. Instantiate the NS

   ```bash
   osm ns-create --ns_name k8s-cluster --nsd_name k8s_juju --vim_account <VIM_ACCOUNT> --config_file config.yaml --ssh_keys ${HOME}/.ssh/id_rsa.pub
   ```

4. Connect to the machine running juju (`k8s_juju` in the NS), check that kubeconfig file exists and test kubectl:

   ```bash
   osm vnf-list --ns k8s-cluster --filter vnfd-ref=k8s_jujucontroller_vnf
   ssh ubuntu@<JUJU_CONTROLLER_IP_ADDRESS>
   cat .kube/config
   kubectl get all
   ```

### \[K8s-02\] Register and de-register Kubernetes clusters in OSM

+50 KiB
Loading image diff...