update the tutorial of kube5g authored by arouk's avatar arouk
This tutorila illustrates an example on how to build kube5g and deploy LTE-OAI network on kubernets. This tutorila illustrates how to build kube5g and deploy mosaic5g operaor, which is built using [Openshift operator SDK](https://github.com/operator-framework/operator-sdk). This tutorial will use [microk8s](https://microk8s.io/) to use [kubernetes](https://kubernetes.io/). For more information on the operator, please visite the official site of [openshift operator](https://www.openshift.com/learn/topics/operators).
More tutorials are availables on [kube5g-tutorials](https://gitlab.eurecom.fr/osama.arouk/kube5g/wikis/home) More tutorials are availables on [kube5g-tutorials](https://gitlab.eurecom.fr/osama.arouk/kube5g/wikis/home)
# How to deploy OAI-LTE using Kubernetes # How to deploy OAI-LTE in Kubernetes using mosaic5g-operator
## Requirements ## Requirements
The following requirements shall be met to sucessfully deploy 4G network using docker: The following requirements shall be met to sucessfully deploy 4G network using docker:
...@@ -16,7 +16,7 @@ The following requirements shall be met to sucessfully deploy 4G network using d ...@@ -16,7 +16,7 @@ The following requirements shall be met to sucessfully deploy 4G network using d
For this tutorial we use the following: For this tutorial we use the following:
- GigaByte Box with ubuntu 16.04 and 16 BG RAM - GigaByte Box with ubuntu 16.04 and 16 BG RAM
- microk8s version: v1.14.10 - microk8s version: v1.14
- kubectl version: 1.17.3 - kubectl version: 1.17.3
- USRP: B210 mini - USRP: B210 mini
- Phone: Google pixel 2 - Phone: Google pixel 2
...@@ -26,44 +26,101 @@ The following figure illustrates the network that we will deploy. It is composed ...@@ -26,44 +26,101 @@ The following figure illustrates the network that we will deploy. It is composed
![Fig_oai_lte](https://i.imgur.com/wDSQiza.jpg) ![Fig_oai_lte](https://i.imgur.com/wDSQiza.jpg)
## kube5g setup ## kube5g setup
* * Build kube5g using build_m5g script:
* Use the build_m5g script to install the requirements of kube5g
```bash
$ ./build_m5g --install-kube5g-req
````
* Use the build_m5g script to build kube5g:
```bash ```bash
$ ./build_m5g -k $ ./build_m5g -k
```` ```
* Add ```--allow-privileged=true``` to both kubelet and kube-apiserver the microk8s, and then restart the services * Install the requirements of kube5g
- Edit the files - Either using the build_m5g script:
```bash ```bash
# kubelet config. Note that you can you your favirite editor, f.g. vim, nano, etc. $ ./build_m5g -i
sudo vim /var/snap/microk8s/current/args/kubelet
``` ```
- Or using the script of mosaic5g-operator:
1. go to the following directory ```mosaic5g_DIR/kube5g/openshift/m5g-operator``` (it is assumed that you are already in the directory ```mosaic5g_DIR```)
```bash ```bash
#kube-apiserver config. Note that you can you your favirite editor, f.g. vim, nano, etc. $ cd kube5g/openshift/m5g-operator
sudo vim /var/snap/microk8s/current/args/kube-apiserver
``` ```
- Restart services: 2. Install the requirements of mosaic5g-operator by:
```bash ```bash
sudo systemctl restart snap.microk8s.daemon-kubelet.service $ ./m5goperator.sh -i
sudo systemctl restart snap.microk8s.daemon-apiserver.service
``` ```
* Apply the manifest in oai-cn and oai-ran (in order). * Make sure that everything is fine by checking the status of ```microk8s````
```bash ```bash
kubectl apply -f kube5g/kubernetes/lte/oai-cn/ $ microk8s.status
kubectl apply -f /kube5g/kubernetes/lte/oai-ran/ microk8s is running
addons:
rbac: disabled
ingress: disabled
dns: enabled
metrics-server: disabled
linkerd: disabled
prometheus: disabled
istio: disabled
jaeger: disabled
fluentd: disabled
gpu: disabled
storage: disabled
dashboard: disabled
registry: disabled
``` ```
* Run mosaic5g-operator as a pod in kubernetes
- Go to ```mosaic5g_DIR/kube5g/openshift/m5g-operator```:
```bash
$ cd kube5g/openshift/m5g-operator
```
- You can discover the capability provided by the script ```m5g-operator.sh````
```bash
$ ./m5goperator.sh
This program installs the requirements to run kubernets on one machine,
and run mosaic5g-operator as a pod inside kubernetes in order to manage
the deployments and services of 4G/5G networks in cloud native environment.
This program also allows to run mosaic5g-operator locally as Golang app.
Options:
-i | --install
Install and run microk8s kubectl, then deploy operator on it"
-n | --init
Apply CRD to k8s cluster (Required for Operator)"
-l | --local
Run Operator as a Golang app at local"
container [start|stop]
Run Operator as a POD inside Kubernetes"
-c | --clean
Remove CRD from cluster"
-r | --remove
remove the snap of kubectl and microk8s
Usage:
./m5goperator.sh -i
./m5goperator.sh container start
```
- Apply the Custom Resource Defintion (CRD) to k8s cluster
```bash
$ ./m5goperator.sh -n
```
- Run mosaic5g-operator as a pod
```bash
$ ./m5goperator.sh container start
```
* Now, Apply the custom resources to bring the LTE network up
```bash
$ kubectl apply -f deploy/crds/mosaic5g_v1alpha1_mosaic5g_cr.yaml
```
After some time, the USRP will be on, and now you can connect the phone to the network.
At this stage, the USRP should start functioning after certain time ### Bring the network down
- After that, you can bring the network down by:
In order to shutdown the network, type the following: ```bash
$ kubectl delete -f deploy/crds/mosaic5g_v1alpha1_mosaic5g_cr.yaml
```
- If you wan to stop the mosaic5g-operator:
```bash
$ ./m5goperator.sh container stop
```
- If you want to remove the Custom Resource Defintion (CRD) from the k8s cluster
```bash
$ ./m5goperator.sh clean
```
- If you want to clean your machine from the installed softwar:
```bash ```bash
kubectl delete -f /kube5g/kubernetes/lte/oai-cn/ $ ./m5goperator.sh -r
kubectl delete -f /kube5g/kubernetes/lte/oai-ran/
``` ```
\ No newline at end of file
You may also want to stop microk8s by typing ```microk8s.stop``` in the terminal
\ No newline at end of file