calico-etcd.yml.j2 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # This manifest installs the Calico etcd on the master. This uses a DaemonSet
  2. # to force it to run on the master even when the master isn't schedulable, and uses
  3. # nodeSelector to ensure it only runs on the master.
  4. apiVersion: extensions/v1beta1
  5. kind: DaemonSet
  6. metadata:
  7. name: calico-etcd
  8. namespace: kube-system
  9. labels:
  10. k8s-app: calico-etcd
  11. spec:
  12. template:
  13. metadata:
  14. labels:
  15. k8s-app: calico-etcd
  16. annotations:
  17. # Mark this pod as a critical add-on; when enabled, the critical add-on scheduler
  18. # reserves resources for critical add-on pods so that they can be rescheduled after
  19. # a failure. This annotation works in tandem with the toleration below.
  20. scheduler.alpha.kubernetes.io/critical-pod: ''
  21. spec:
  22. tolerations:
  23. # this taint is set by all kubelets running `--cloud-provider=external`
  24. # so we should tolerate it to schedule the calico pods
  25. - key: node.cloudprovider.kubernetes.io/uninitialized
  26. value: "true"
  27. effect: NoSchedule
  28. # Toleration allows the pod to run on master
  29. - key: node-role.kubernetes.io/master
  30. effect: NoSchedule
  31. # Allow this pod to be rescheduled while the node is in "critical add-ons only" mode.
  32. # This, along with the annotation above marks this pod as a critical add-on.
  33. - key: CriticalAddonsOnly
  34. operator: Exists
  35. # Only run this pod on configure nodes with calico-etcd true in /etc/ansible/hosts.
  36. nodeSelector:
  37. calico-etcd: "true"
  38. hostNetwork: true
  39. serviceAccountName: calico-node
  40. containers:
  41. - name: calico-etcd
  42. image: quay.io/coreos/etcd:v3.2.5
  43. env:
  44. - name: CALICO_ETCD_IP
  45. valueFrom:
  46. fieldRef:
  47. fieldPath: status.podIP
  48. - name: CALICO_ETCD_NAME
  49. valueFrom:
  50. fieldRef:
  51. fieldPath: spec.nodeName
  52. command: ["/bin/sh","-c"]
  53. args: ["/usr/local/bin/etcd --name=$CALICO_ETCD_NAME --data-dir={{ calico_etcd_mount }}/calico-data --advertise-client-urls=https://$CALICO_ETCD_IP:{{ calico_etcd_clients_port }} --listen-client-urls=https://0.0.0.0:{{ calico_etcd_clients_port }} --listen-peer-urls=https://$CALICO_ETCD_IP:{{ calico_etcd_peers_port }} --cert-file={{ calico_etcd_cert_file }} --key-file={{ calico_etcd_key_file }} --trusted-ca-file={{ calico_etcd_ca_cert_file }} --initial-cluster-token=calico-cluster-1 --initial-cluster={{ calico_etcd_initial_cluster }} --initial-advertise-peer-urls=https://$CALICO_ETCD_IP:{{ calico_etcd_peers_port }} --peer-client-cert-auth --peer-trusted-ca-file={{ calico_etcd_ca_cert_file }} --peer-cert-file={{ calico_etcd_cert_file }} --peer-key-file={{ calico_etcd_key_file }}"]
  54. securityContext:
  55. privileged: true
  56. volumeMounts:
  57. - name: var-etcd
  58. mountPath: {{ calico_etcd_mount }}
  59. - name: etcd-certs
  60. mountPath: {{ calico_etcd_cert_dir }}
  61. volumes:
  62. - name: var-etcd
  63. hostPath:
  64. path: {{ calico_etcd_mount }}
  65. - name: etcd-certs
  66. hostPath:
  67. path: {{ calico_etcd_cert_dir }}
  68. ---
  69. # This manifest installs the Service which gets traffic to the Calico
  70. # etcd.
  71. apiVersion: v1
  72. kind: Service
  73. metadata:
  74. labels:
  75. k8s-app: calico-etcd
  76. name: calico-etcd
  77. namespace: kube-system
  78. spec:
  79. # Select the calico-etcd pod running on the master.
  80. selector:
  81. k8s-app: calico-etcd
  82. # This ClusterIP needs to be known in advance, since we cannot rely
  83. # on DNS to get access to etcd.
  84. clusterIP: {{ calico_etcd_service_ip }}
  85. ports:
  86. - port: {{ calico_etcd_clients_port }}