blob: ad1a82cdbde51dd4227381576b819362c9fbd5c8 [file] [log] [blame]
wriderc1be4252019-11-26 10:13:54 -05001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. SPDX-License-Identifier: CC-BY-4.0
3.. ===============LICENSE_START=======================================================
Lott, Christopher (cl778h)c22d1ce2020-01-20 13:53:43 -05004.. Copyright (C) 2019-2020 AT&T Intellectual Property
wriderc1be4252019-11-26 10:13:54 -05005.. ===================================================================================
Lott, Christopher (cl778h)c22d1ce2020-01-20 13:53:43 -05006.. 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
wriderc1be4252019-11-26 10:13:54 -05008.. compliance with the License. You may obtain a copy of the License at
9..
10.. http://creativecommons.org/licenses/by/4.0
11..
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=========================================================
17
18
Zhe Huangdc00cdf2020-02-10 13:45:15 -050019Script for Setting Up 1-node Kubernetes Cluster
20^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wriderc1be4252019-11-26 10:13:54 -050021
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050022The it/dep repo can be used for generating a simple script that can help setting up a
23one-node Kubernetes cluster for dev and testing purposes. Related files are under the
Zhe Huangdc00cdf2020-02-10 13:45:15 -050024**tools/k8s/bin** directory. Clone the repository on the target VM:
wriderc1be4252019-11-26 10:13:54 -050025
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050026::
27
Lott, Christopher (cl778h)ca9b3ee2020-01-20 15:56:57 -050028 % git clone https://gerrit.o-ran-sc.org/r/it/dep
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050029
wriderc1be4252019-11-26 10:13:54 -050030
31Configurations
Zhe Huangdc00cdf2020-02-10 13:45:15 -050032^^^^^^^^^^^^^^
wriderc1be4252019-11-26 10:13:54 -050033
34The generation of the script reads in the parameters from the following files:
35
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050036- etc/env.rc: Normally no change needed for this file. If where the Kubernetes cluster runs
37 has special requirements, such as running private Docker registry with self-signed certificates,
38 or hostnames that can be only resolved via private /etc/hosts entries, such parameters are
39 entered into this file.
40- etc/infra.rc: This file specifies the docker host, Kubernetes, and Kubernetes CNI versions.
41 If a version is left empty, the installation will use the default version that the OS package
42 management software would install.
43- etc/openstack.rc: If the Kubernetes cluster is deployed on Open Stack VMs, this file specifies
44 parameters for accessing the APIs of the Open Stack installation. This is not supported in Amber
45 release yet.
wriderc1be4252019-11-26 10:13:54 -050046
47
48Generating Set-up Script
Zhe Huangdc00cdf2020-02-10 13:45:15 -050049^^^^^^^^^^^^^^^^^^^^^^^^
wriderc1be4252019-11-26 10:13:54 -050050
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050051After the configurations are updated, the following steps will create a script file that can be
52used for setting up a one-node Kubernetes cluster. You must run this command on a Linux machine
53with the 'envsubst' command installed.
wriderc1be4252019-11-26 10:13:54 -050054
55::
56
Zhe Huangdc00cdf2020-02-10 13:45:15 -050057 % cd tools/k8s/bin
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050058 % ./gen-cloud-init.sh
wriderc1be4252019-11-26 10:13:54 -050059
Lott, Christopher (cl778h)c22d1ce2020-01-20 13:53:43 -050060A file named **k8s-1node-cloud-init.sh** would now appear under the bin directory.
wriderc1be4252019-11-26 10:13:54 -050061
62
63Setting up Kubernetes Cluster
Zhe Huangdc00cdf2020-02-10 13:45:15 -050064^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wriderc1be4252019-11-26 10:13:54 -050065
Lott, Christopher (cl778h)c22d1ce2020-01-20 13:53:43 -050066The new **k8s-1node-cloud-init.sh** file is now ready for setting up the Kubernetes cluster.
wriderc1be4252019-11-26 10:13:54 -050067
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050068It can be run from a root shell of an existing Ubuntu 16.04 or 18.04 VM. Running this script
69will replace any existing installation of Docker host, Kubernetes, and Helm on the VM. The
70script will reboot the machine upon successful completion. Run the script like this:
wriderc1be4252019-11-26 10:13:54 -050071
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050072::
wriderc1be4252019-11-26 10:13:54 -050073
Lott, Christopher (cl778h)cb200332020-01-20 15:56:57 -050074 % sudo -i
75 # ./k8s-1node-cloud-init.sh
76
77This script can also be used as the user-data (a.k.a. cloud-init script) supplied to Open Stack
78when launching a new Ubuntu 16.04 or 18.04 VM.
79
80Upon successful execution of the script and reboot of the machine, when queried in a root shell
81with the kubectl command the VM should display information similar to below:
wriderc1be4252019-11-26 10:13:54 -050082
83::
84
85 # kubectl get pods --all-namespaces
86 NAMESPACE NAME READY STATUS RESTARTS AGE
87 kube-system coredns-5644d7b6d9-4gjp5 1/1 Running 0 103m
88 kube-system coredns-5644d7b6d9-pvsj8 1/1 Running 0 103m
89 kube-system etcd-ljitest 1/1 Running 0 102m
90 kube-system kube-apiserver-ljitest 1/1 Running 0 103m
91 kube-system kube-controller-manager-ljitest 1/1 Running 0 102m
92 kube-system kube-flannel-ds-amd64-nvjmq 1/1 Running 0 103m
93 kube-system kube-proxy-867v5 1/1 Running 0 103m
94 kube-system kube-scheduler-ljitest 1/1 Running 0 102m
95 kube-system tiller-deploy-68bf6dff8f-6pwvc 1/1 Running 0 102m