etcd.manifest 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {
  2. "apiVersion": "v1",
  3. "kind": "Pod",
  4. "metadata": {
  5. "name":"etcd-server{{ suffix }}",
  6. "namespace": "kube-system",
  7. "annotations": {
  8. "scheduler.alpha.kubernetes.io/critical-pod": "",
  9. "seccomp.security.alpha.kubernetes.io/pod": "docker/default"
  10. }
  11. },
  12. "spec":{
  13. "hostNetwork": true,
  14. "containers":[
  15. {
  16. "name": "etcd-container",
  17. "image": "{{ pillar.get('etcd_docker_repository', 'k8s.gcr.io/etcd') }}:{{ pillar.get('etcd_docker_tag', '3.3.10-1') }}",
  18. "resources": {
  19. "requests": {
  20. "cpu": {{ cpulimit }}
  21. }
  22. },
  23. "command": [
  24. "/bin/sh",
  25. "-c",
  26. "if [ -e /usr/local/bin/migrate-if-needed.sh ]; then /usr/local/bin/migrate-if-needed.sh 1>>/var/log/etcd{{ suffix }}.log 2>&1; fi; exec /usr/local/bin/etcd --name etcd-{{ hostname }} --listen-peer-urls {{ etcd_protocol }}://{{ host_ip }}:{{ server_port }} --initial-advertise-peer-urls {{ etcd_protocol }}://{{ hostname }}:{{ server_port }} --advertise-client-urls http://127.0.0.1:{{ port }} --listen-client-urls http://{{ listen_client_ip }}:{{ port }} {{ quota_bytes }} --data-dir /var/etcd/data{{ suffix }} --initial-cluster-state {{ cluster_state }} --initial-cluster {{ etcd_cluster }} {{ etcd_creds }} {{ etcd_apiserver_creds }} {{ etcd_extra_args }} 1>>/var/log/etcd{{ suffix }}.log 2>&1"
  27. ],
  28. "env": [
  29. { "name": "TARGET_STORAGE",
  30. "value": "{{ pillar.get('storage_backend', 'etcd3') }}"
  31. },
  32. { "name": "TARGET_VERSION",
  33. "value": "{{ pillar.get('etcd_version', '3.3.10') }}"
  34. },
  35. { "name": "DATA_DIRECTORY",
  36. "value": "/var/etcd/data{{ suffix }}"
  37. },
  38. { "name": "INITIAL_CLUSTER",
  39. "value": "{{ etcd_cluster }}"
  40. },
  41. { "name": "LISTEN_PEER_URLS",
  42. "value": "{{ etcd_protocol }}://{{ host_ip }}:{{ server_port }}"
  43. },
  44. { "name": "INITIAL_ADVERTISE_PEER_URLS",
  45. "value": "{{ etcd_protocol }}://{{ hostname }}:{{ server_port }}"
  46. },
  47. { "name": "ETCD_CREDS",
  48. "value": "{{ etcd_creds }}"
  49. },
  50. { "name": "ETCD_APISERVER_CREDS",
  51. "value": "{{ etcd_apiserver_creds }}"
  52. },
  53. { "name": "ETCD_SNAPSHOT_COUNT",
  54. "value": "10000"
  55. }
  56. ],
  57. "livenessProbe": {
  58. "httpGet": {
  59. "host": "127.0.0.1",
  60. "port": {{ port }},
  61. "path": "/health"
  62. },
  63. "initialDelaySeconds": {{ liveness_probe_initial_delay }},
  64. "timeoutSeconds": 15
  65. },
  66. "ports": [
  67. { "name": "serverport",
  68. "containerPort": {{ server_port }},
  69. "hostPort": {{ server_port }}
  70. },
  71. { "name": "clientport",
  72. "containerPort": {{ port }},
  73. "hostPort": {{ port }}
  74. }
  75. ],
  76. "volumeMounts": [
  77. { "name": "varetcd",
  78. "mountPath": "/var/etcd",
  79. "readOnly": false
  80. },
  81. { "name": "varlogetcd",
  82. "mountPath": "/var/log/etcd{{ suffix }}.log",
  83. "readOnly": false
  84. },
  85. { "name": "etc",
  86. "mountPath": "/etc/srv/kubernetes",
  87. "readOnly": false
  88. }
  89. ]
  90. }
  91. ],
  92. "volumes":[
  93. { "name": "varetcd",
  94. "hostPath": {
  95. "path": "/mnt/master-pd/var/etcd"}
  96. },
  97. { "name": "varlogetcd",
  98. "hostPath": {
  99. "path": "/var/log/etcd{{ suffix }}.log",
  100. "type": "FileOrCreate"}
  101. },
  102. { "name": "etc",
  103. "hostPath": {
  104. "path": "/etc/srv/kubernetes"}
  105. }
  106. ]
  107. }}