Skip to content

Instantly share code, notes, and snippets.

@jjo
Last active December 20, 2020 10:09
Show Gist options
  • Select an option

  • Save jjo/78f60702fbfa1cbec7dd865f67a3728a to your computer and use it in GitHub Desktop.

Select an option

Save jjo/78f60702fbfa1cbec7dd865f67a3728a to your computer and use it in GitHub Desktop.
#!/bin/bash -x
# curl -L bit.do/jjo-pwk-sh | bash -x
#
## Setup http://labs.play-with-k8s.com/ env ala' jjo
# FIXUP some play-with-k8s annoyances
kubectl cluster-info || (
kubeadm init --apiserver-advertise-address $(hostname -i)
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 install -y bash-completion git-core tmux vim wget sudo which >& yum-0.log
kubectl completion bash > /etc/bash_completion.d/kubectl.completion
source /etc/bash_completion.d/kubectl.completion
# dev tools and latest GO
yum -y install gcc gcc-go gcc-c++ make strace lsof
curl -LO https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
tar -C /usr/local -xvzf go1.8.linux-amd64.tar.gz
ln -sf /usr/local/go/bin/go /usr/local/bin/go
# jjo'isms
git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config
git clone http://github.com/jjo/bin
# re-echo the node join CLI
echo "kubeadm join --token=$(kubeadm token list|sed -nr '/bootstrap/s/ .+//p') $(hostname -i)"
# tmate ftW
wget 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:"
echo "pkill -1 tmate"
script -qfc tmate |egrep -o ssh.session:.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment