Add script with commands to create ONAP in single VM 23/223/1
authorafenner <andrew.fenner@est.tech>
Fri, 21 Dec 2018 12:06:36 +0000 (12:06 +0000)
committerafenner <andrew.fenner@est.tech>
Fri, 21 Dec 2018 12:24:39 +0000 (12:24 +0000)
Change-Id: Ieccdad5ef61063c1fad88c2989edf3ce9d69daca
Signed-off-by: andrew.fenner <andrew.fenner@est.tech>
misc_onap_scripts/setup_onap_inonevm.sh [new file with mode: 0755]

diff --git a/misc_onap_scripts/setup_onap_inonevm.sh b/misc_onap_scripts/setup_onap_inonevm.sh
new file mode 100755 (executable)
index 0000000..8ef9d3d
--- /dev/null
@@ -0,0 +1,270 @@
+# This is a set commands that can install an ONAP in a HUGE VM.
+# they were assembeled by jan.j.martensson@ericsson.com and tested to run in the environment made available by
+# https://etherpad.opnfv.org/p/laas-access
+#
+# They will probably not work "out of the box" but form the basis of a set of commands that can work
+
+# Turn off firewall and allow all incoming HTTP connections through IPTABLES
+
+ufw disable
+
+iptables -I INPUT -j ACCEPT
+
+
+
+# Install git
+
+apt-get install -y git
+
+
+
+# Install needed utilities
+
+apt-get install -y apt-transport-https ca-certificates curl software-properties-common
+
+
+
+# Install Docker
+
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
+
+add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
+
+apt-get update
+
+apt-get install -y docker-ce=17.03.3~ce-0~ubuntu-xenial
+
+
+
+# Install Kubernetes
+
+curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
+
+add-apt-repository "deb [arch=amd64] https://apt.kubernetes.io/ kubernetes-xenial main"
+
+apt-get update
+
+apt-get install -y kubelet=1.11.2-00
+
+apt-get install -y kubectl=1.11.2-00
+
+apt-get install -y kubeadm=1.11.2-00
+
+git clone https://github.com/kubernetes-incubator/metrics-server.git
+#cd metrics-server/
+#kubectl create -f metrics-server/deploy/1.8+/
+
+
+# Install Helm
+
+wget http://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
+
+tar -zxvf helm-v2.9.1-linux-amd64.tar.gz
+
+mv linux-amd64/helm /usr/local/bin/helm
+
+
+
+# Install jq
+
+apt-get install -y jq
+
+
+
+# Install make
+
+apt-get install -y make
+
+
+
+# Create a yaml file to change the default value of maxpods from 110 to 300
+
+cat > maxpods.yaml << EOF
+
+apiVersion: kubeadm.k8s.io/v1alpha2
+
+kubeletConfiguration:
+
+  baseConfig:
+    maxPods: 300
+    serializeImagePulls: false
+EOF
+
+
+
+# Initialize the kubernetes cluster. If needed, disable swap (swapoff -a) before running kubeadm
+
+kubeadm init --config maxpods.yaml | tee ~/kubeadm_init.log
+
+
+
+# Execute the following snippet to get kubectl to work
+
+mkdir -p $HOME/.kube
+
+cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
+
+chown $(id -u):$(id -g) $HOME/.kube/config
+
+
+
+# Install the Weaver pod network
+
+kubectl apply -f https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')
+
+
+
+# Check status
+
+kubectl get pods --all-namespaces -o wide
+
+
+
+# Untaint the cluster
+
+kubectl taint nodes --all node-role.kubernetes.io/master-
+
+
+
+# Create a yaml file to define the Tiller service account and cluster role binding
+
+cat > tiller-serviceaccount.yaml << EOF
+
+apiVersion: v1
+
+kind: ServiceAccount
+
+metadata:
+
+  name: tiller
+
+  namespace: kube-system
+
+---
+
+kind: ClusterRoleBinding
+
+apiVersion: rbac.authorization.k8s.io/v1beta1
+
+metadata:
+
+  name: tiller-clusterrolebinding
+
+subjects:
+
+- kind: ServiceAccount
+
+  name: tiller
+
+  namespace: kube-system
+
+roleRef:
+
+  kind: ClusterRole
+
+  name: cluster-admin
+
+  apiGroup: ""
+
+EOF
+
+
+
+# Create a ServiceAccount and ClusterRoleBinding based on the created file.
+
+kubectl create -f tiller-serviceaccount.yaml
+
+kubectl create -f metrics-server/deploy/1.8+/
+
+
+# Initialize Helm to install Tiller
+
+helm init --service-account tiller --upgrade
+
+
+
+# Check status
+
+kubectl get pods --all-namespaces -o wide
+
+
+
+# Clone the OOM project
+
+git clone https://gerrit.onap.org/r/oom
+
+cd oom/kubernetes
+
+
+
+# Copy oom/kubernetes/helm/plugins directory into your local ~/.helm/ folder
+
+cp -R ~/oom/kubernetes/helm/plugins/ ~/.helm
+
+
+
+# Create Helm repository
+
+make repo
+
+
+
+# Create Helm charts
+
+make; make onap
+
+
+
+# Deploy ONAP from the OOM codebase using local Helm Chart Repository (default configuration values defined in onap/values.yaml)
+
+helm deploy demo local/onap --namespace onap
+
+
+
+# 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.
+
+kubectl get pods --all-namespaces -o wide
+
+#kubectl delete -n onap pod <pod name>
+
+
+
+# After the failing Portal pods have been deleted and healed, check status of the portal-app service
+
+#kubectl get services -n onap | grep portal-app
+
+#portal-app  LoadBalancer   10.108.87.95   <pending>    8989:30215/TCP,8006:30213/TCP,8010:30214/TCP,8443:30225/TCP   22h
+
+
+
+# Workaround to avoid the pending EXTERNAL-IP for portal-app
+
+#kubectl -n onap expose deployment demo-portal-portal-app --type=LoadBalancer --name=portal-wa --external-ip=<host IP address> --port=8443 --target-port=8443
+
+
+
+# Check status of the portal-wa service. The EXTERNAL-IP should be present
+
+#kubectl get services -n onap | grep portal-wa
+
+#portal-wa  LoadBalancer   10.105.168.224   10.10.100.32    8443:30997/TCP        16s
+
+
+
+# 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”
+
+#vim /etc/hosts
+
+
+
+# Access the ONAP Portal with curl or web browser
+
+#curl -k https://portal.api.simpledemo.onap.org:8443/ONAPPORTAL/login.htm
+
+
+
+# Install firefox. Ignore the warnings
+
+apt-get install -y firefox
+
+#firefox&