Created
June 28, 2016 07:38
-
-
Save FaKod/51f7af6a541a31f15ac28062914b691e to your computer and use it in GitHub Desktop.
Ansible node template for Torus installation as a Volume Plugin
This file contains hidden or 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
#cloud-config | |
write-files: | |
- path: /opt/bin/wupiao | |
permissions: '0755' | |
content: | | |
#!/bin/bash | |
# [w]ait [u]ntil [p]ort [i]s [a]ctually [o]pen | |
[ -n "$1" ] && [ -n "$2" ] && while ! curl --output /dev/null \ | |
--silent --head --fail \ | |
http://${1}:${2}; do sleep 1 && echo -n .; done; | |
exit $? | |
- path: /etc/modules-load.d/nbd.conf | |
content: nbd | |
- path: /opt/bin/gettorus | |
permissions: '0755' | |
content: | | |
#!/bin/bash | |
/usr/bin/mkdir -p /etc/kubernetes/volumeplugins/coreos.com~torus | |
/usr/bin/curl -L https://github.com/coreos/torus/releases/download/v0.1.1/torus_v0.1.1_linux_amd64.tar.gz \ | |
| tar -xzO torus_v0.1.1_linux_amd64/torusblk --strip-components 1 \ | |
> /etc/kubernetes/volumeplugins/coreos.com~torus/torus | |
/usr/bin/chmod +x /etc/kubernetes/volumeplugins/coreos.com~torus/torus | |
exit $? | |
coreos: | |
etcd2: | |
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 | |
advertise-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 | |
initial-cluster: master=http://{{ k8s_master.default_ip }}:2380 | |
proxy: on | |
fleet: | |
metadata: "role=node" | |
units: | |
- name: systemd-modules-load.service | |
command: restart | |
- name: etcd2.service | |
command: start | |
- name: fleet.service | |
command: start | |
- name: flanneld.service | |
command: start | |
- name: docker.service | |
drop-ins: | |
- name: 40-flannel.conf | |
content: | | |
[Unit] | |
Requires=flanneld.service | |
After=flanneld.service | |
command: start | |
- name: setup-network-environment.service | |
command: start | |
content: | | |
[Unit] | |
Description=Setup Network Environment | |
Documentation=https://github.com/kelseyhightower/setup-network-environment | |
Requires=network-online.target | |
After=network-online.target | |
[Service] | |
ExecStartPre=-/usr/bin/mkdir -p /opt/bin | |
ExecStartPre=/usr/bin/curl -L -o /opt/bin/setup-network-environment -z /opt/bin/setup-network-environment https://github.com/kelseyhightower/setup-network-environment/releases/download/v1.0.0/setup-network-environment | |
ExecStartPre=/usr/bin/chmod +x /opt/bin/setup-network-environment | |
ExecStart=/opt/bin/setup-network-environment | |
RemainAfterExit=yes | |
Type=oneshot | |
- name: kube-proxy.service | |
command: start | |
content: | | |
[Unit] | |
Description=Kubernetes Proxy | |
Documentation=https://github.com/GoogleCloudPlatform/kubernetes | |
Requires=setup-network-environment.service | |
After=setup-network-environment.service | |
[Service] | |
ExecStartPre=/usr/bin/curl -L -o /opt/bin/kube-proxy -z /opt/bin/kube-proxy https://storage.googleapis.com/kubernetes-release/release/{{k8s_version}}/bin/linux/amd64/kube-proxy | |
ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-proxy | |
# wait for kubernetes master to be up and ready | |
ExecStartPre=/opt/bin/wupiao {{ k8s_master.default_ip }} 8080 | |
ExecStart=/opt/bin/kube-proxy \ | |
--master={{ k8s_master.default_ip }}:8080 \ | |
--logtostderr=true | |
Restart=always | |
RestartSec=10 | |
- name: kube-kubelet.service | |
command: start | |
content: | | |
[Unit] | |
Description=Kubernetes Kubelet | |
Documentation=https://github.com/GoogleCloudPlatform/kubernetes | |
Requires=setup-network-environment.service | |
After=setup-network-environment.service | |
[Service] | |
EnvironmentFile=/etc/network-environment | |
ExecStartPre=/usr/bin/curl -L -o /opt/bin/kubelet -z /opt/bin/kubelet https://storage.googleapis.com/kubernetes-release/release/{{k8s_version}}/bin/linux/amd64/kubelet | |
ExecStartPre=/usr/bin/chmod +x /opt/bin/kubelet | |
# Install Torus | |
ExecStartPre=/opt/bin/gettorus | |
# wait for kubernetes master to be up and ready | |
ExecStartPre=/opt/bin/wupiao {{ k8s_master.default_ip }} 8080 | |
ExecStart=/opt/bin/kubelet \ | |
--address=0.0.0.0 \ | |
--port=10250 \ | |
--cluster-dns=10.100.0.10 \ | |
--cluster-domain=cluster.local \ | |
--hostname-override=${DEFAULT_IPV4} \ | |
--api-servers={{ k8s_master.default_ip }}:8080 \ | |
--allow-privileged=true \ | |
--logtostderr=true \ | |
--cadvisor-port=4194 \ | |
--healthz-bind-address=0.0.0.0 \ | |
--healthz-port=10248 \ | |
--volume-plugin-dir=/etc/kubernetes/volumeplugins | |
Restart=always | |
RestartSec=10 | |
update: | |
group: beta | |
reboot-strategy: best-effort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment