-
-
Save alodha100/656dcb8b534254732993a427559067a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
## Setup http://labs.play-with-k8s.com/ env ala' jjo | |
# YEAH I TRUST RUNNING STUFF DIRECTLY AS ROOT way -> | |
# | |
# bash -x <( curl -L bit.do/jjo-pwk-sh ) | |
# | |
# https://gist.github.com/jjo/78f60702fbfa1cbec7dd865f67a3728a/edit | |
# http://bit.do/admin/edit/jjo-pwk-sh | |
# | |
# Initialize cluster and FIXUP some play-with-k8s annoyances | |
test -d /etc/kubernetes/pki || ( | |
kubeadm init --apiserver-advertise-address $(hostname -i) | tee ~/kubeadm-init.log | |
kubectl apply -n kube-system -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 -w0)" | |
curl -L -s https://git.io/kube-dashboard | sed 's/targetPort: 9090/targetPort: 9090\n type: LoadBalancer/' | kubectl apply -f - | |
kubectl get deployment --namespace=kube-system kube-dns -oyaml|sed -r 's,(.*--server)=(/ip6.arpa/.*),&\n\1=8.8.8.8,'|kubectl apply -f - | |
) | |
# k8s comfy'ness | |
cd | |
yum -q -y install bash-completion git-core tmux vim wget sudo which > /dev/null | |
kubectl completion bash > /etc/bash_completion.d/kubectl.completion | |
source /etc/bash_completion.d/kubectl.completion | |
# helm | |
HELM_VERSION=2.7.2 | |
curl -LO https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz | |
tar -xvf helm-v${HELM_VERSION}-linux-amd64.tar.gz | |
mv linux-amd64/helm /usr/local/bin/ | |
helm init | |
helm repo update | |
# dev tools and latest GO | |
GO_VERSION=1.9.2 | |
yum -q -y install gcc gcc-go gcc-c++ make strace lsof > /dev/null | |
curl -LO https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz | |
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz | |
ln -sf /usr/local/go/bin/go* /usr/local/bin/ | |
# jjo'isms | |
git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config/ | |
git clone http://github.com/jjo/bin | |
# show kubeadm join ... | |
echo "* Join nodes with:" | |
grep -o "kubeadm.*join.*" ~/kubeadm-init.log | |
kubeadm join --token $(kubeadm token list |sed -n 2p|egrep -o '^\S+') $(sed -rn s,.*server:.*//,,p /etc/kubernetes/admin.conf) | |
# tmate ftW | |
wget -q https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin | |
echo "* Connect to address about to be shown, then run : pkill -1 tmate" | |
# ssh keys needed by tmate to start: | |
ssh-keygen -t rsa -b 4096 -P "" -f "$HOME/.ssh/id_rsa" | |
(script -qfc tmate |egrep -o "ssh \S+tmate.io") & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment