You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.7 KiB

8 years ago
  1. ---
  2. apiVersion: v1
  3. kind: Pod
  4. metadata:
  5. name: etcd
  6. namespace: kube-system
  7. spec:
  8. hostNetwork: true
  9. containers:
  10. - name: etcd
  11. image: quay.io/coreos/etcd:v2.2.2
  12. resources:
  13. limits:
  14. cpu: 100m
  15. memory: 256M
  16. args:
  17. {% if inventory_hostname in groups['etcd'] %}
  18. - --name
  19. - etcd-{{inventory_hostname}}-master
  20. - --advertise-client-urls
  21. - "http://{{ hostvars[inventory_hostname]['ip'] | default( ansible_default_ipv4.address) }}:2379"
  22. - --listen-peer-urls
  23. - http://0.0.0.0:2380
  24. - --initial-advertise-peer-urls
  25. - http://{{ hostvars[inventory_hostname]['ip'] | default( ansible_default_ipv4.address) }}:2380
  26. - --data-dir
  27. - /var/etcd/data
  28. - --initial-cluster-state
  29. - new
  30. {% else %}
  31. - --proxy
  32. - 'on'
  33. {% endif %}
  34. - --listen-client-urls
  35. - "http://{{ hostvars[inventory_hostname]['ip'] | default( ansible_default_ipv4.address) }}:2379,http://127.0.0.1:2379"
  36. - --initial-cluster
  37. - "{% for host in groups['etcd'] %}etcd-{{host}}-master=http://{{ hostvars[host]['ip'] | default( hostvars[host]['ansible_default_ipv4']['address']) }}:2380{% if not loop.last %},{% endif %}{% endfor %}"
  38. - --initial-cluster-token
  39. - etcd-k8s-cluster
  40. ports:
  41. - name: etcd-client
  42. containerPort: 2379
  43. hostPort: 2379
  44. - name: etcd-peer
  45. containerPort: 2380
  46. hostPort: 2380
  47. volumeMounts:
  48. - name: varetcd
  49. mountPath: /var/etcd
  50. readOnly: false
  51. volumes:
  52. - name: varetcd
  53. hostPath:
  54. path: /containers/pods/etcd-{{inventory_hostname}}/rootfs/var/etcd