Skip to content

Instantly share code, notes, and snippets.

@Darkflib
Last active May 27, 2018 19:59
Show Gist options
  • Save Darkflib/31fd60a476ef1ea77908b992b91f27e8 to your computer and use it in GitHub Desktop.
Save Darkflib/31fd60a476ef1ea77908b992b91f27e8 to your computer and use it in GitHub Desktop.
kube - ubuntu
#!/bin/sh
#########
#
# Note: this does not provide a production ready cluster. It will produce a dev cluster with a single etcd daemon.
#
##########
apt-get -y update
apt-get -y upgrade
apt-get -y install apt-transport-https ca-certificates curl software-properties-common tmux vim
# docker key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# kube key
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get -y update
apt-get install -y docker-ce
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
apt-get install -y kubelet kubeadm kubectl
docker run hello-world
# docker and tools should be now inst5alled
# Below are notes of how to continue installation on the master - these are mostly untested.
# make a note of the command displayed to run on other boxes
kubeadm init
export KUBECONFIG=/etc/kubernetes/admin.conf
# If you want to be able to control the cluster from somewhere other than the master node...
# scp root@<master ip>:/etc/kubernetes/admin.conf .
# kubectl --kubeconfig ./admin.conf get nodes
# run the kubeadm command on the other nodes.
# install calico
kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml
# wait for them to show as ready
watch kubectl get nodes
# wait for all pods to show as ready
watch kubectl get pods --all-namespaces
# By default the master doesn't run any non-system pods. We can change this if we want to...
kubectl taint nodes --all node-role.kubernetes.io/master-
# install helm
curl https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-linux-amd64.tar.gz |tar xz
mv linux-amd64/helm /usr/bin/
chmod 755 /usr/bin/helm │
rm -rf linux-amd64/
# Istio
# From https://istio.io/docs/setup/kubernetes/quick-start.html
curl -L https://git.io/getLatestIstio | sh -
export PATH="$PATH:/root/istio-0.5.1/bin"
cd istio-0.5.1
# For non-mutual-TLS apps
kubectl apply -f install/kubernetes/istio.yaml
# OR mutual-TLS
kubectl apply -f install/kubernetes/istio-auth.yaml
# Add Zipkin
kubectl apply -f install/kubernetes/addons/zipkin.yaml
# Add Prometheus
kubectl apply -f install/kubernetes/addons/prometheus.yaml
# Injector appears broken the way I installed it at present... :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment