Skip to content

Instantly share code, notes, and snippets.

@kincl
Created December 31, 2016 13:53
Show Gist options
  • Save kincl/d75cbb1c74c4e47c16d8e3ba3ca2a20b to your computer and use it in GitHub Desktop.
Save kincl/d75cbb1c74c4e47c16d8e3ba3ca2a20b to your computer and use it in GitHub Desktop.
kubeadm on gce
# -- Bootstrap kubelet on each node
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y docker kubelet kubeadm kubectl kubernetes-cni
cat <<EOF > /etc/sysconfig/docker-storage-setup
DEVS=/dev/sdb
VG=docker-vg
EOF
docker-storage-setup
systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet
# --
# -- Start kubeadm on master
IP=$(curl -s -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/ip)
EXTIP=$(curl -s -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip)
kubeadm init --cloud-provider gce --api-advertise-addresses=${IP},${EXTIP}
kubectl apply -f https://git.io/weave-kube
kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
kubectl apply -f 'https://cloud.weave.works/launch/k8s/weavescope.yaml'
# --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment