1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. SPDX-License-Identifier: CC-BY-4.0
3 .. ===============LICENSE_START=======================================================
4 .. Copyright (C) 2019-2020 AT&T Intellectual Property
5 .. ===================================================================================
6 .. This documentation file is distributed under the Creative Commons Attribution
7 .. 4.0 International License (the "License"); you may not use this file except in
8 .. compliance with the License. You may obtain a copy of the License at
10 .. http://creativecommons.org/licenses/by/4.0
12 .. This file is distributed on an "AS IS" BASIS,
13 .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 .. See the License for the specific language governing permissions and
15 .. limitations under the License.
16 .. ===============LICENSE_END=========================================================
19 **Script for Setting Up 1-node Kubernetes Cluster**
21 The it/dep repo can be used for generating a simple script that can help setting up a
22 one-node Kubernetes cluster for dev and testing purposes. Related files are under the
23 **tools/k8s/bin** directory. Clone the repository on the target VM:
27 % git clone https://gerrit.o-ran-sc.org/r/it/dep
32 The generation of the script reads in the parameters from the following files:
34 - etc/env.rc: Normally no change needed for this file. If where the Kubernetes cluster runs
35 has special requirements, such as running private Docker registry with self-signed certificates,
36 or hostnames that can be only resolved via private /etc/hosts entries, such parameters are
37 entered into this file.
38 - etc/infra.rc: This file specifies the docker host, Kubernetes, and Kubernetes CNI versions.
39 If a version is left empty, the installation will use the default version that the OS package
40 management software would install.
41 - etc/openstack.rc: If the Kubernetes cluster is deployed on Open Stack VMs, this file specifies
42 parameters for accessing the APIs of the Open Stack installation. This is not supported in Amber
46 **Generating Set-up Script**
48 After the configurations are updated, the following steps will create a script file that can be
49 used for setting up a one-node Kubernetes cluster. You must run this command on a Linux machine
50 with the 'envsubst' command installed.
57 A file named **k8s-1node-cloud-init.sh** would now appear under the bin directory.
60 **Setting up Kubernetes Cluster**
62 The new **k8s-1node-cloud-init.sh** file is now ready for setting up the Kubernetes cluster.
64 It can be run from a root shell of an existing Ubuntu 16.04 or 18.04 VM. Running this script
65 will replace any existing installation of Docker host, Kubernetes, and Helm on the VM. The
66 script will reboot the machine upon successful completion. Run the script like this:
71 # ./k8s-1node-cloud-init.sh
73 This script can also be used as the user-data (a.k.a. cloud-init script) supplied to Open Stack
74 when launching a new Ubuntu 16.04 or 18.04 VM.
76 Upon successful execution of the script and reboot of the machine, when queried in a root shell
77 with the kubectl command the VM should display information similar to below:
81 # kubectl get pods --all-namespaces
82 NAMESPACE NAME READY STATUS RESTARTS AGE
83 kube-system coredns-5644d7b6d9-4gjp5 1/1 Running 0 103m
84 kube-system coredns-5644d7b6d9-pvsj8 1/1 Running 0 103m
85 kube-system etcd-ljitest 1/1 Running 0 102m
86 kube-system kube-apiserver-ljitest 1/1 Running 0 103m
87 kube-system kube-controller-manager-ljitest 1/1 Running 0 102m
88 kube-system kube-flannel-ds-amd64-nvjmq 1/1 Running 0 103m
89 kube-system kube-proxy-867v5 1/1 Running 0 103m
90 kube-system kube-scheduler-ljitest 1/1 Running 0 102m
91 kube-system tiller-deploy-68bf6dff8f-6pwvc 1/1 Running 0 102m
93 **Onetime setup for Influxdb**
95 Once Kubernetes setup is done, we have to create PersistentVolume through the storage class for the influxdb database.
96 The following one time process should be followed before deploying the influxdb in ricplt namespace.
100 # User has to check the following namespace exist or not using
101 % kubectl get ns ricinfra
103 # If the namespace doesn’t exist, then create it using:
104 % kubectl create ns ricinfra
106 % helm install stable/nfs-server-provisioner --namespace ricinfra --name nfs-release-1
107 % kubectl patch storageclass nfs -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
108 % sudo apt install nfs-common