k8s-docker-suite-app-murano/Kubernetes/KubernetesCluster/elements/kubernetes/install.d/57-kubernetes
Artem Silenkov ed467511e7 [qcow2 image][kubernetes] Scripts updated to use latest etcd
* latest etcd is enabled
  * ntp tools added for time sync
  * Readme updated for tmpfs workaround when 8Gb memory is detected

Change-Id: Ifdfb72902fad843baef1fcee3e5bc65b119bdde3
2016-08-16 11:58:34 +03:00

77 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
install-packages curl wget linux-libc-dev git gcc libc6-dev bridge-utils haproxy ntp ntpdate
SVC_ROOT=/opt/bin
ETCD_LATEST_VERSION="v3.0.4"
KUBE_LATEST_VERSION="v1.3.0"
FLANNEL_LATEST_VERSION="v0.5.5"
ETCD_LATEST_URL="https://github.com/coreos/etcd/releases/download/${ETCD_LATEST_VERSION}/etcd-${ETCD_LATEST_VERSION}-linux-amd64.tar.gz"
KUBE_LATEST_URL="https://github.com/GoogleCloudPlatform/kubernetes/releases/download/${KUBE_LATEST_VERSION}/kubernetes.tar.gz"
FLANNEL_LATEST_URL="https://github.com/coreos/flannel/archive/${FLANNEL_LATEST_VERSION}.tar.gz"
mkdir -p ${SVC_ROOT}
pushd ${SVC_ROOT}
# Install latest etcd
wget -O ${SVC_ROOT}/etcd-latest.tar.gz $ETCD_LATEST_URL
tar xzvf ${SVC_ROOT}/etcd-latest.tar.gz
rm -f ${SVC_ROOT}/etcd-latest.tar.gz
mv ${SVC_ROOT}/etcd-${ETCD_LATEST_VERSION}-linux-amd64/etcd ${SVC_ROOT}/
mv ${SVC_ROOT}/etcd-${ETCD_LATEST_VERSION}-linux-amd64/etcdctl ${SVC_ROOT}/
rm -rf ${SVC_ROOT}/etcd-${ETCD_LATEST_VERSION}-linux-amd64
# Install latest kubernetes
wget -O ${SVC_ROOT}/kubernetes-latest.tar.gz $KUBE_LATEST_URL
tar xzvf ${SVC_ROOT}/kubernetes-latest.tar.gz
rm -f ${SVC_ROOT}/kubernetes-latest.tar.gz
tar xzvf ${SVC_ROOT}/kubernetes/server/kubernetes-server-linux-amd64.tar.gz
mv ${SVC_ROOT}/kubernetes ${SVC_ROOT}/kubernetes-latest
cp ${SVC_ROOT}/kubernetes-latest/server/bin/* ${SVC_ROOT}/
# Install Go
wget -O go.tar.gz https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz
tar xzvf go.tar.gz
mv ${SVC_ROOT}/go /usr/local/go
export PATH=$PATH:/usr/local/go/bin
# Build flannel
wget -O ${SVC_ROOT}/flannel-latest.tar.gz $FLANNEL_LATEST_URL
tar xzvf ${SVC_ROOT}/flannel-latest.tar.gz
rm -f ${SVC_ROOT}/flannel-latest.tar.gz
mv ${SVC_ROOT}/flannel-* ${SVC_ROOT}/flannel
pushd ${SVC_ROOT}/flannel
${SVC_ROOT}/flannel/build
popd
cp ${SVC_ROOT}/flannel/bin/flanneld ${SVC_ROOT}/flanneld
rm -rf ${SVC_ROOT}/flannel
# Update system PATH
sed -i 's/PATH="/PATH="\/opt\/bin:\/opt\/go\/bin:/g' /etc/environment
wget -O confd https://github.com/kelseyhightower/confd/releases/download/v0.7.1/confd-0.7.1-linux-amd64
mv confd /usr/local/bin/confd
chmod +x /usr/local/bin/confd
mkdir -p /etc/confd/{conf.d,templates}
popd
if [[ $(lsb_release -c -s) == 'jessie' ]]; then
#Enable cgroup memory if Debian 8 is used. Required by k8s since 1.2
echo 'GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"' >> /etc/default/grub
#Do not start haproxy on vm boot
systemctl disable haproxy
fi