| {%- from "etcd/map.jinja" import server with context %} |
| { |
| "apiVersion": "v1", |
| "kind": "Pod", |
| "metadata": { |
| "name":"etcd-server", |
| "namespace": "kube-system" |
| }, |
| "spec":{ |
| "hostNetwork": true, |
| "containers":[ |
| { |
| "name": "etcd-container", |
| "image": "{{ server.registry }}/etcd:{{ server.version }}", |
| "resources": { |
| "requests": { |
| "cpu": "200m" } |
| }, |
| "command": [ |
| "/bin/sh", |
| "-c", |
| "/usr/local/bin/etcd --name {{ pillar.linux.system.name }} --initial-cluster-state new --initial-advertise-peer-urls http://{{ server.bind.host }}:2380 --listen-peer-urls http://{{ server.bind.host }}:2380 --advertise-client-urls http://{{ server.bind.host }}:4001 --listen-client-urls {%- if server.bind.host == '127.0.0.1' %}{% for member in server.members %} http://{{ member.host }}:4001{% endfor %}{% else %} http://{{ server.host }}:4001{% endif %},http://127.0.0.1:4001 --initial-cluster {% for member in server.members %}{{ member.name }}={%- if server.bind.host == '127.0.0.1' %}http://127.0.0.1:2380{% else %}http://{{ member.host }}:2380{% if not loop.last %},{% endif %}{% endif %}{% endfor %} --initial-cluster-token {{ server.token }} --data-dir /var/lib/etcd/default 1>>/var/log/etcd.log 2>&1" |
| ], |
| "livenessProbe": { |
| "httpGet": { |
| "host": "127.0.0.1", |
| "port": 4001, |
| "path": "/health" |
| }, |
| "initialDelaySeconds": 15, |
| "timeoutSeconds": 15 |
| }, |
| "ports":[ |
| { "name": "serverport", |
| "containerPort": 2380, |
| "hostPort": 2380 |
| },{ |
| "name": "clientport", |
| "containerPort": 4001, |
| "hostPort": 4001 |
| } |
| ], |
| "volumeMounts": [ |
| {"name": "varetcd", |
| "mountPath": "/var/lib/etcd", |
| "readOnly": false |
| }, |
| {"name": "varlogetcd", |
| "mountPath": "/var/log/etcd.log", |
| "readOnly": false |
| } |
| ] |
| } |
| ], |
| "volumes":[ |
| { "name": "varetcd", |
| "hostPath": { |
| "path": "/var/lib/etcd"} |
| }, |
| { "name": "varlogetcd", |
| "hostPath": { |
| "path": "/var/log/etcd.log"} |
| } |
| ] |
| }} |