1 # This is a set commands that can install an ONAP in a HUGE VM.
2 # they were assembeled by jan.j.martensson@ericsson.com and tested to run in the environment made available by
3 # https://etherpad.opnfv.org/p/laas-access
5 # They will probably not work "out of the box" but form the basis of a set of commands that can work
7 # Turn off firewall and allow all incoming HTTP connections through IPTABLES
11 iptables -I INPUT -j ACCEPT
17 apt-get install -y git
21 # Install needed utilities
23 apt-get install -y apt-transport-https ca-certificates curl software-properties-common
29 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
31 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
35 apt-get install -y docker-ce=17.03.3~ce-0~ubuntu-xenial
41 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
43 add-apt-repository "deb [arch=amd64] https://apt.kubernetes.io/ kubernetes-xenial main"
47 apt-get install -y kubelet=1.11.2-00
49 apt-get install -y kubectl=1.11.2-00
51 apt-get install -y kubeadm=1.11.2-00
53 git clone https://github.com/kubernetes-incubator/metrics-server.git
55 #kubectl create -f metrics-server/deploy/1.8+/
60 wget http://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
62 tar -zxvf helm-v2.9.1-linux-amd64.tar.gz
64 mv linux-amd64/helm /usr/local/bin/helm
76 apt-get install -y make
80 # Create a yaml file to change the default value of maxpods from 110 to 300
82 cat > maxpods.yaml << EOF
84 apiVersion: kubeadm.k8s.io/v1alpha2
90 serializeImagePulls: false
95 # Initialize the kubernetes cluster. If needed, disable swap (swapoff -a) before running kubeadm
97 kubeadm init --config maxpods.yaml | tee ~/kubeadm_init.log
101 # Execute the following snippet to get kubectl to work
105 cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
107 chown $(id -u):$(id -g) $HOME/.kube/config
111 # Install the Weaver pod network
113 kubectl apply -f https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')
119 kubectl get pods --all-namespaces -o wide
123 # Untaint the cluster
125 kubectl taint nodes --all node-role.kubernetes.io/master-
129 # Create a yaml file to define the Tiller service account and cluster role binding
131 cat > tiller-serviceaccount.yaml << EOF
141 namespace: kube-system
145 kind: ClusterRoleBinding
147 apiVersion: rbac.authorization.k8s.io/v1beta1
151 name: tiller-clusterrolebinding
155 - kind: ServiceAccount
159 namespace: kube-system
173 # Create a ServiceAccount and ClusterRoleBinding based on the created file.
175 kubectl create -f tiller-serviceaccount.yaml
177 kubectl create -f metrics-server/deploy/1.8+/
180 # Initialize Helm to install Tiller
182 helm init --service-account tiller --upgrade
188 kubectl get pods --all-namespaces -o wide
192 # Clone the OOM project
194 git clone https://gerrit.onap.org/r/oom
200 # Copy oom/kubernetes/helm/plugins directory into your local ~/.helm/ folder
202 cp -R ~/oom/kubernetes/helm/plugins/ ~/.helm
206 # Create Helm repository
218 # Deploy ONAP from the OOM codebase using local Helm Chart Repository (default configuration values defined in onap/values.yaml)
220 helm deploy demo local/onap --namespace onap
224 # Check status. It will take more than 60 minutes before ONAP is installed. There will be several failing pods. Several of the failing pods can be healed by deleting the pods. The failing pods that cannot be healed need deeper analysis.
226 kubectl get pods --all-namespaces -o wide
228 #kubectl delete -n onap pod <pod name>
232 # After the failing Portal pods have been deleted and healed, check status of the portal-app service
234 #kubectl get services -n onap | grep portal-app
236 #portal-app LoadBalancer 10.108.87.95 <pending> 8989:30215/TCP,8006:30213/TCP,8010:30214/TCP,8443:30225/TCP 22h
240 # Workaround to avoid the pending EXTERNAL-IP for portal-app
242 #kubectl -n onap expose deployment demo-portal-portal-app --type=LoadBalancer --name=portal-wa --external-ip=<host IP address> --port=8443 --target-port=8443
246 # Check status of the portal-wa service. The EXTERNAL-IP should be present
248 #kubectl get services -n onap | grep portal-wa
250 #portal-wa LoadBalancer 10.105.168.224 10.10.100.32 8443:30997/TCP 16s
254 # Update /etc/hosts with “<host IP address> portal.api.simpledemo.onap.org sdc.api.simpledemo.onap.org sdc.api.fe.simpledemo.onap.org vid.api.simpledemo.onap.org cli.api.simpledemo.onap.org aai.api.sparky.simpledemo.onap.org aai.onap portal-app.onap”
260 # Access the ONAP Portal with curl or web browser
262 #curl -k https://portal.api.simpledemo.onap.org:8443/ONAPPORTAL/login.htm
266 # Install firefox. Ignore the warnings
268 apt-get install -y firefox