Skip to content

Instantly share code, notes, and snippets.

@skinny
Created November 11, 2015 21:12
Show Gist options
  • Save skinny/2a628a991b1a3b46253c to your computer and use it in GitHub Desktop.
Save skinny/2a628a991b1a3b46253c to your computer and use it in GitHub Desktop.
cloud-config-template
#cloud-config
write_files:
- path: /opt/bin/curl-retry.sh
permissions: '0755'
owner: root
content: |
#!/bin/sh -x
until curl $@
do sleep 1
done
- path: /etc/modprobe.d/bonding.conf
permissions: 0644
owner: root
content: |
options bonding miimon=100 mode=4 lacp_rate=1
- path: /etc/modules-load.d/bonding.conf
permissions: 0644
owner: root
content: |
bonding
coreos:
units:
- name: systemd-networkd.service
command: stop
- name: 00-bond0.netdev
runtime: true
content: |
[NetDev]
Name=bond0
Kind=bond
- name: 00-vlan40.netdev
runtime: true
content: |
[NetDev]
Name=vlan40
Kind=vlan
[VLAN]
Id=40
- name: 00-bond1.netdev
runtime: true
content: |
[NetDev]
Name=bond1
Kind=bond
- name: 01-enp2s0f0.network
content: |
[Match]
Name=enp2s0f0
[Network]
Bond=bond0
- name: 01-enp4s0f0.network
content: |
[Match]
Name=enp4s0f0
[Network]
Bond=bond0
- name: 01-enp2s0f1.network
content: |
[Match]
Name=enp2s0f1
[Network]
Bond=bond1
- name: 01-enp4s0f1.network
content: |
[Match]
Name=enp4s0f1
[Network]
Bond=bond1
- name: 99-dhcp.network
runtime: true
content: |
[Match]
Name=en*
[Network]
DHCP=no
- name: down-interfaces.service
command: start
content: |
[Service]
Type=oneshot
ExecStart=/usr/bin/ip link set enp2s0f0 down
ExecStart=/usr/bin/ip addr flush dev enp2s0f0
ExecStart=/usr/bin/ip link set enp2s0f1 down
ExecStart=/usr/bin/ip addr flush dev enp2s0f1
ExecStart=/usr/bin/ip link set enp4s0f0 down
ExecStart=/usr/bin/ip addr flush dev enp4s0f0
ExecStart=/usr/bin/ip link set enp4s0f1 down
ExecStart=/usr/bin/ip addr flush dev enp4s0f1
ExecStart=/usr/bin/ip link set enp5s0f0 down
ExecStart=/usr/bin/ip addr flush dev enp5s0f0
ExecStart=/usr/bin/ip link set enp5s0f1 down
ExecStart=/usr/bin/ip addr flush dev enp5s0f1
- name: systemd-networkd.service
command: restart
- name: flanneld.service
command: start
- name: docker.service
drop-ins:
- name: 40-flannel.conf
content: |
[Unit]
Requires=flanneld.service
After=flanneld.service
- name: kubernetes-node.target
enable: true
command: start
content: |
[Unit]
Description=Kubernetes Cluster Node
Documentation=http://kubernetes.io/
RefuseManualStart=no
Wants=kube-proxy.service
Wants=kubelet.service
[Install]
WantedBy=multi-user.target
- name: kubernetes-master.target
enable: true
command: start
content: |
[Unit]
Description=Kubernetes Cluster Master
Documentation=http://kubernetes.io/
RefuseManualStart=no
ConditionHost=node-00
Wants=kube-apiserver.service
Wants=kube-scheduler.service
Wants=kube-controller-manager.service
Wants=kube-proxy.service
[Install]
WantedBy=multi-user.target
- name: install-kubernetes.service
enable: true
content: |
[Unit]
After=network-online.target
Before=kube-apiserver.service
Before=kube-controller-manager.service
Before=kubelet.service
Before=kube-proxy.service
Description=Download Kubernetes Binaries
Documentation=http://kubernetes.io/
Requires=network-online.target
ConditionPathExists=|!/opt/kubernetes/server/bin/kubectl
[Service]
Environment=KUBE_RELEASE_TARBALL=https://github.com/kubernetes/kubernetes/releases/download/v1.1.1/kubernetes.tar.gz
ExecStartPre=/bin/mkdir -p /opt/
ExecStart=/opt/bin/curl-retry.sh --silent --location $KUBE_RELEASE_TARBALL --output /tmp/kubernetes.tgz
ExecStart=/bin/tar xzvf /tmp/kubernetes.tgz -C /tmp/
ExecStart=/bin/tar xzvf /tmp/kubernetes/server/kubernetes-server-linux-amd64.tar.gz -C /opt
ExecStartPost=/bin/chmod o+rx -R /opt/kubernetes
ExecStartPost=/bin/ln -s /opt/kubernetes/server/bin/kubectl /opt/bin/
RemainAfterExit=yes
Type=oneshot
[Install]
WantedBy=kubernetes-master.target
WantedBy=kubernetes-node.target
- name: kube-apiserver.service
enable: true
content: |
[Unit]
After=install-kubernetes.service
Before=kube-controller-manager.service
Before=kube-scheduler.service
ConditionFileIsExecutable=/opt/kubernetes/server/bin/kube-apiserver
Description=Kubernetes API Server
Documentation=http://kubernetes.io/
Wants=install-kubernetes.service
ConditionHost=node-00
[Service]
ExecStart=/opt/kubernetes/server/bin/kube-apiserver \
--address=0.0.0.0 \
--port=8080 \
--secure_port=443 \
$ETCD_SERVERS \
--service-cluster-ip-range=10.1.0.0/16 \
--logtostderr=true --v=3 \
--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota \
--tls-cert-file=/etc/kubernetes/ssl/apiserver.pem \
--tls-private-key-file=/etc/kubernetes/ssl/apiserver-key.pem \
--client-ca-file=/etc/kubernetes/ssl/ca.pem \
--service-account-key-file=/etc/kubernetes/ssl/apiserver-key.pem \
--runtime-config=api/v1=true \
--runtime-config=extensions/v1beta1/daemonsets=true
Restart=always
RestartSec=10
[Install]
WantedBy=kubernetes-master.target
- name: kube-scheduler.service
enable: true
content: |
[Unit]
After=kube-apiserver.service
After=install-kubernetes.service
ConditionFileIsExecutable=/opt/kubernetes/server/bin/kube-scheduler
Description=Kubernetes Scheduler
Documentation=http://kubernetes.io/
Wants=kube-apiserver.service
ConditionHost=node-00
[Service]
ExecStart=/opt/kubernetes/server/bin/kube-scheduler \
--logtostderr=true \
--master=127.0.0.1:8080
Restart=always
RestartSec=10
[Install]
WantedBy=kubernetes-master.target
- name: kube-controller-manager.service
enable: true
content: |
[Unit]
After=install-kubernetes.service
After=kube-apiserver.service
ConditionFileIsExecutable=/opt/kubernetes/server/bin/kube-controller-manager
Description=Kubernetes Controller Manager
Documentation=http://kubernetes.io/
Wants=kube-apiserver.service
Wants=install-kubernetes.service
ConditionHost=node-00
[Service]
ExecStart=/opt/kubernetes/server/bin/kube-controller-manager \
--master=127.0.0.1:8080 \
--logtostderr=true \
--service-account-private-key-file=/etc/kubernetes/ssl/apiserver-key.pem \
--root-ca-file=/etc/kubernetes/ssl/ca.pem
Restart=always
RestartSec=10
[Install]
WantedBy=kubernetes-master.target
- name: kubelet.service
enable: true
content: |
[Unit]
After=install-kubernetes.service
ConditionFileIsExecutable=/opt/kubernetes/server/bin/kubelet
Description=Kubernetes Kubelet
Documentation=http://kubernetes.io/
Wants=install-kubernetes.service
[Service]
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests/
ExecStart=/opt/kubernetes/server/bin/kubelet \
--register-node=true \
--hostname-override=%H \
--api-servers=https://node-00 \
--logtostderr=true \
--cluster-dns=10.1.0.3 \
--allow-privileged=true \
--cluster-domain=cluster.local \
--config=/etc/kubernetes/manifests/ \
--tls-cert-file=/etc/kubernetes/ssl/worker.pem \
--tls-private-key-file=/etc/kubernetes/ssl/worker-key.pem \
--kubeconfig=/etc/kubernetes/worker-kubeconfig.yaml
Restart=always
RestartSec=10
[Install]
WantedBy=kubernetes-node.target
- name: kube-proxy.service
enable: true
content: |
[Unit]
After=install-kubernetes.service
ConditionFileIsExecutable=/opt/kubernetes/server/bin/kube-proxy
Description=Kubernetes Proxy
Documentation=http://kubernetes.io/
Wants=install-kubernetes.service
[Service]
ExecStart=/opt/kubernetes/server/bin/kube-proxy \
--master=https://node-00 \
--kubeconfig=/etc/kubernetes/worker-kubeconfig.yaml \
--logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=kubernetes-master.target
WantedBy=kubernetes-node.target
- name: rpc-statd.service
command: start
enable: true
- name: create-nfs-mountpoints.service
command: start
content: |
[Unit]
After=local-fs.target
Requires=local-fs.target
[Service]
ExecStart=/bin/mkdir -p /mnt/nfs5
ExecStart=/bin/mkdir -p /mnt/nfs1
Type=oneshot
- name: mnt-nfs5.mount
command: start
content: |
[Unit]
After=network-online.target
Requires=network-online.target
After=create-nfs-mountpoints.service
Requires=create-nfs-mountpoints.service
[Mount]
What=10.172.40.241:/volumes/vol5/vol5_nfs01
Where=/mnt/nfs5
Type=nfs
etcd2:
name: '%H'
initial-cluster-token: 'eva-cluster'
initial-advertise-peer-urls: 'http://%H:2380'
listen-peer-urls: 'http://%H:2380'
listen-client-urls: 'http://0.0.0.0:2379'
advertise-client-urls: 'http://%H:2379'
initial-cluster-state: 'new'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment