--- /dev/null
+#!/bin/bash -ex
+
+CLUSTER_IP=${1:-172.16.1.136} # Align with the value in our K8s setup script
+CALICO_URI_ROOT=https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation
+
+# Install the Etcd Database
+if [ "$(uname -m)" == 'aarch64' ]; then
+ ETCD_YAML=https://raw.githubusercontent.com/Jingzhao123/arm64TemporaryCalico/temporay_arm64/v3.3/getting-started/kubernetes/installation/hosted/etcd-arm64.yaml
+else
+ ETCD_YAML=${CALICO_URI_ROOT}/hosted/etcd.yaml
+fi
+wget -O etcd.yaml "${ETCD_YAML}"
+sed -i "s/10.96.232.136/${CLUSTER_IP}/" etcd.yaml
+kubectl apply -f etcd.yaml
+
+# Install the RBAC Roles required for Calico
+kubectl apply -f "${CALICO_URI_ROOT}/rbac.yaml"
+
+# Install Calico to system
+wget -O calico.yaml "${CALICO_URI_ROOT}/hosted/calico.yaml"
+sed -i "s/10.96.232.136/${CLUSTER_IP}/" calico.yaml
+if [ "$(uname -m)" == 'aarch64' ]; then
+ sed -i "s/quay.io\/calico/calico/" calico.yaml
+fi
+# FIXME: IP_AUTODETECTION_METHOD?
+kubectl apply -f calico.yaml
+
+# Remove the taints on master node
+kubectl taint nodes --all node-role.kubernetes.io/master- || true
--- /dev/null
+#!/bin/bash -ex
+
+VERSION='v2.12.3'
+if [ "$(uname -m)" == 'aarch64' ]; then
+ FLAVOR='linux-arm64'
+else
+ FLAVOR='linux-amd64'
+fi
+
+URI_ROOT='https://storage.googleapis.com/kubernetes-helm'
+TGZ_NAME="helm-${VERSION}-${FLAVOR}.tar.gz"
+
+if [ ! -e /usr/bin/helm ] || [ ! -e /usr/bin/tiller ]; then
+ wget -O "/tmp/${TGZ_NAME}" "${URI_ROOT}/${TGZ_NAME}"
+ sudo tar xpPf "/tmp/${TGZ_NAME}" --overwrite \
+ --transform "s|${FLAVOR}|/usr/bin|" "${FLAVOR}/"{helm,tiller}
+ rm -f "/tmp/${TGZ_NAME}"
+fi
--- /dev/null
+#!/bin/bash -ex
+
+DOCKER_VERSION=18.06.1~ce~3-0~ubuntu
+KUBE_VERSION=1.13.0-00
+
+# Install Docker as Prerequisite
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+sudo apt-key fingerprint 0EBFCD88
+sudo add-apt-repository \
+ "deb https://download.docker.com/linux/ubuntu \
+ $(lsb_release -cs) \
+ stable"
+sudo apt update
+sudo apt install -y docker-ce=${DOCKER_VERSION}
+
+# Disable swap on your machine
+sudo swapoff -a
+
+# Install Kubernetes with Kubeadm
+sudo apt update
+sudo apt install -y apt-transport-https curl
+curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
+
+cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
+deb https://apt.kubernetes.io/ kubernetes-xenial main
+EOF
+sudo apt update
+sudo apt install -y \
+ kubelet=${KUBE_VERSION} kubeadm=${KUBE_VERSION} kubectl=${KUBE_VERSION}
+apt-mark hold kubelet kubeadm kubectl
+
+_conf='/etc/sysctl.d/99-akraino-iec.conf'
+echo 'net.bridge.bridge-nf-call-iptables = 1' |& sudo tee "${_conf}"
+sudo sysctl -q -p "${_conf}"
--- /dev/null
+#!/bin/bash -ex
+
+# For host setup as Kubernetes master
+MGMT_IP=$1
+POD_NETWORK_CIDR=${2:-192.168.0.0/16}
+SERVICE_CIDR=${3:-172.16.1.0/24}
+
+if [ -z "${MGMT_IP}" ]; then
+ echo "Please specify a management IP!"
+ exit 1
+fi
+
+if ! kubectl get nodes; then
+ sudo kubeadm config images pull
+ sudo kubeadm init \
+ --pod-network-cidr="${POD_NETWORK_CIDR}" \
+ --apiserver-advertise-address="${MGMT_IP}" \
+ --service-cidr="${SERVICE_CIDR}"
+
+ if [ "$(id -u)" = 0 ]; then
+ echo "export KUBECONFIG=/etc/kubernetes/admin.conf" | \
+ tee -a "${HOME}/.profile"
+ # shellcheck disable=SC1090
+ source "${HOME}/.profile"
+ else
+ mkdir -p "${HOME}/.kube"
+ sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config"
+ sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config"
+ fi
+fi
--- /dev/null
+#!/bin/bash -ex
+
+NGINX_APP=~/nginx-app.yaml
+
+cat <<EOF > "${NGINX_APP}"
+apiVersion: v1
+kind: Service
+metadata:
+ name: nginx
+ labels:
+ app: nginx
+spec:
+ type: NodePort
+ ports:
+ - port: 80
+ protocol: TCP
+ name: http
+ selector:
+ app: nginx
+---
+apiVersion: v1
+kind: ReplicationController
+metadata:
+ name: nginx
+spec:
+ replicas: 2
+ template:
+ metadata:
+ labels:
+ app: nginx
+ spec:
+ containers:
+ - name: nginx
+ image: nginx
+ ports:
+ - containerPort: 80
+EOF
+
+if ! kubectl get services | grep -q nginx; then
+ kubectl create -f "${NGINX_APP}"
+fi
+kubectl get nodes
+kubectl get services
+kubectl get pods
+kubectl get rc
+
+attempts=60
+while [ $attempts -gt 0 ]
+do
+ if [ 3 == "$(kubectl get pods | grep -c -e STATUS -e Running)" ]; then
+ break
+ fi
+ ((attempts-=1))
+ sleep 10
+done
+[ $attempts -gt 0 ] || exit 1
+
+svcip=$(kubectl get services nginx -o json | grep clusterIP | cut -f4 -d'"')
+sleep 10
+wget "http://$svcip"
+kubectl delete -f "${NGINX_APP}"
+kubectl get rc
+kubectl get pods
+kubectl get services