為因應計畫要用的 Demo,先把我做過的事情紀錄一下
部署架構如下圖所示
遇到問題別緊張,最下面有個「Debug Space」,可以多去看看,如果出現沒有在這上面的問題的話,再去請教 Google 大師吧~!
O-RAN 官方提供的 script 包含了 k8s 的安裝,所以其實可以不用先手動安裝 k8s,但如果已經有的話,你可以減少很多步驟,很棒~!
以下範例我們用 B 版本示範與說明 (我在寫得時候已經更新到 D 了)
$ cd /home/user
$ sudo -i
$ git clone http://gerrit.o-ran-sc.org/r/it/dep -b bronze
$ cd dep
$ git submodule update --init --recursive --remote
此步驟將生成一個腳本,該腳本將設置單節點 Kubernetes 集群以安裝 SMO 元件。
## 將版本需求設定調整為Frankfurt
$ cd tools/k8s/etc
$ vim infra.rc
此時即可生成部署K8S叢集腳本
$ cd ../bin
$ ./gen-cloud-init.sh
$ ls
產生之腳本 「k8s-1node-cloud-init-k_1_15-h_2_16-d_18_09.sh」
官方提供的腳本中有一些問題,在部署時需要注意所有套件是否正常安裝完成(尤其是docker)
這裡主要是將腳本指令中的docker進行手動安裝
$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update
$ apt-cache madison docker-ce
$ sudo apt-get install docker-ce=5:18.09.7~3-0~ubuntu-bionic
修改腳本「k8s-1node-cloud-init-k_1_15-h_2_16-d_18_09.sh」helm內容
helm init --stable-repo-url=https://charts.helm.sh/stable
完成上述修改後即可開始執行腳本
$ ./k8s-1node-cloud-init-k_1_15-h_2_16-d_18_09.sh
完成後主機將進行重啟,重啟完畢後便可檢查是否有啟動9個pod
$ sudo su
$ kubectl get pods --all-namespaces
部署SMO相關套件,包含nonrtric、onap、ricaux,安裝順序為 onap → nonrtric → ricaux
前往資料夾並修改install腳本
$ cd /home/<user>/dep/smo/bin
$ vim install
若是第一次執行則使用以下指令
$ ./install initlocalrepo
若不是則使用以下指令
$ ./install
這過程會很久很漫長,請耐心等候
當執行完成後,腳本在安裝 nonrtric 會出現問題(0.0),此時便需要跳脫腳本,進行手動安裝
根據自己 Near-RT RIC 主機 IP 為何,修改「example_recipe.yaml」的「baseUrl」
(若無,則不需要管此處的 IP addresses)
$ vim dep/nonrtric/RECIPE_EXAMPLE/example_recipe.yaml
運行其安裝腳本
$ cd dep/bin
$ ./deploy-nonrtric -f /home/oprueba/oran/dep/nonrtric/RECIPE_EXAMPLE/example_recipe.yaml
等待其腳本完成,應啟動如下Pod
首先建立namespace
$ kubectl create ns ricinfra
接著取得相依套件
$ cd ~/dep/ric-aux/helm/infrastructure
$ helm dep update
開始進行安裝部署
$ cd ../
$ helm install -f ~/dep/RECIPE_EXAMPLE/AUX/example_recipe.yaml --name cherry-infra --namespace ricaux ./infrastructure
完成後可以先透過指令查詢是否成功,若不成功可以先進行修正
$ kubectl get all -n ricaux
確認沒問題後,可以進行VES的安裝
$ cd ves/
$ helm dep update
$ cd ../
$ helm install -f ~/dep/RECIPE_EXAMPLE/AUX/example_recipe.yaml --name cherry-ves --namespace ricaux ./ves
當完成後就可以查看所有pod的狀態
$ kubectl get pod -A
以上,SMO主機已部署完成
$ helm init --stable-repo-url=https://charts.helm.sh/stable
$ git clone https://gerrit.onap.org/r/oom.git
$ cp -R oom/kubernetes/helm/plugins/ ~/.helm/
複製完成後,再次輸入helm指令便可看到deploy命令,完成後進行intall腳本繼續安裝
bash $ sudo helm serve
,其結果應顯示如下圖所示$ cd /home/oprueba/oran/dep/smo/bin/smo-deploy/smo-oom/kubernetes
$ make all
$ helm init --client-only # 因為此處tiller已正常啟動,因此後面需要添加「--client-only」
$ kubectl describe pod/cherry-infra-kong-7d6555954f-h2fp9 -n ricaux
可以發現錯誤訊息為「Failed to pull image "kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.7.0(http://kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.7.0)": rpc error: code = Unknown desc = Error response from daemon: error parsing HTTP 403 response body: invalid character…以下略」
可能為該映像檔聯結有誤,可進入設定檔進行修改
$ vim ~/dep/ric-aux/helm/infrastructure/subcharts/kong/values.yaml
repository: kong/kubernetes-ingress-controller
tag: 0.7.0
完成後再回到步驟4的ricaux安裝流程
$ kubectl create serviceaccount --namespace kube-system tiller
$ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
$ kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
$ helm init --service-account tiller --upgrade