Forked from jjo/play-with-k8s.com-jjo-setup.sh
Last active
November 8, 2018 11:51
Star
You must be signed in to star a gist
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 https://gist.githubusercontent.com/rossbachp/45c079fe3e551efe29826a2e49a61067/raw/5c6c5055148ad9f53cb9690f799a9b5c25b1fef6/play-with-k8s.com-jjo-setup.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 coredns -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.11.0 | |
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/ | |
cat >rbac-tiller.yaml <<EOF | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: tiller | |
namespace: kube-system | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: tiller | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: cluster-admin | |
subjects: | |
- kind: ServiceAccount | |
name: tiller | |
namespace: kube-system | |
EOF | |
kubectl apply -f rbac-tiller.yaml | |
helm init --service-account tiller | |
helm repo update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment