Created
January 29, 2018 10:17
-
-
Save johackim/ab0d68fe949995ec9b451e677d46002c to your computer and use it in GitHub Desktop.
Kubernetes installation
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/sh | |
export DEBIAN_FRONTEND=noninteractive; | |
if [ "$(whoami)" != "root" ]; then | |
echo "$0: Permission denied" | |
exit 1; | |
fi | |
# Install kubeadm | |
if [ -z "$(command -v kubeadm)" ]; then | |
echo "kubeadm installation" | |
apt-get update && apt-get install -y apt-transport-https docker.io | |
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
apt-get update && apt-get install -y kubelet kubeadm kubernetes-cni | |
fi | |
# Start kubernetes cluster | |
systemctl restart kubelet | |
kubeadm init --pod-network-cidr=10.32.0.0/12 | |
mkdir -p ~/.kube && cp /etc/kubernetes/admin.conf ~/.kube/config | |
kubectl taint nodes --all node-role.kubernetes.io/master- | |
kubectl apply -f https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter.yaml | |
# Install helm | |
if [ -z "$(command -v helm)" ]; then | |
curl -s https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment