Use Multi-arch etcd yaml to support Calico
[iec.git] / src / foundation / scripts / cni / calico / etcd.yaml
1 ---
2 # This manifest installs the Calico etcd on the kubeadm master.  This uses a DaemonSet
3 # to force it to run on the master even when the master isn't schedulable, and uses
4 # nodeSelector to ensure it only runs on the master.
5 apiVersion: extensions/v1beta1
6 kind: DaemonSet
7 metadata:
8   name: calico-etcd-arm64
9   namespace: kube-system
10   labels:
11     k8s-app: calico-etcd
12 spec:
13   template:
14     metadata:
15       labels:
16         k8s-app: calico-etcd
17       annotations:
18         # Mark this pod as a critical add-on; when enabled, the critical add-on scheduler
19         # reserves resources for critical add-on pods so that they can be rescheduled after
20         # a failure.  This annotation works in tandem with the toleration below.
21         scheduler.alpha.kubernetes.io/critical-pod: ''
22     spec:
23       tolerations:
24         # This taint is set by all kubelets running `--cloud-provider=external`
25         # so we should tolerate it to schedule the Calico pods
26         - key: node.cloudprovider.kubernetes.io/uninitialized
27           value: "true"
28           effect: NoSchedule
29         # Allow this pod to run on the master.
30         - key: node-role.kubernetes.io/master
31           effect: NoSchedule
32         # Allow this pod to be rescheduled while the node is in "critical add-ons only" mode.
33         # This, along with the annotation above marks this pod as a critical add-on.
34         - key: CriticalAddonsOnly
35           operator: Exists
36       # Only run this pod on the master.
37       nodeSelector:
38         node-role.kubernetes.io/master: ""
39         beta.kubernetes.io/arch: arm64
40       hostNetwork: true
41       containers:
42         - name: calico-etcd
43           image: quay.io/coreos/etcd:v3.3.9-arm64
44           env:
45             - name: CALICO_ETCD_IP
46               valueFrom:
47                 fieldRef:
48                   fieldPath: status.podIP
49             - name: ETCD_UNSUPPORTED_ARCH
50               value: "arm64"
51           command:
52             - /usr/local/bin/etcd
53           args:
54             - --name=calico
55             - --data-dir=/var/etcd/calico-data
56             - --advertise-client-urls=http://$(CALICO_ETCD_IP):6666
57             - --listen-client-urls=http://0.0.0.0:6666
58             - --listen-peer-urls=http://0.0.0.0:6667
59             - --auto-compaction-retention=1
60           volumeMounts:
61             - name: var-etcd
62               mountPath: /var/etcd
63       volumes:
64         - name: var-etcd
65           hostPath:
66             path: /var/etcd
67
68 ---
69 # This manifest installs the Calico etcd on the kubeadm master.  This uses a DaemonSet
70 # to force it to run on the master even when the master isn't schedulable, and uses
71 # nodeSelector to ensure it only runs on the master.
72 apiVersion: extensions/v1beta1
73 kind: DaemonSet
74 metadata:
75   name: calico-etcd-amd64
76   namespace: kube-system
77   labels:
78     k8s-app: calico-etcd
79 spec:
80   template:
81     metadata:
82       labels:
83         k8s-app: calico-etcd
84       annotations:
85         # Mark this pod as a critical add-on; when enabled, the critical add-on scheduler
86         # reserves resources for critical add-on pods so that they can be rescheduled after
87         # a failure.  This annotation works in tandem with the toleration below.
88         scheduler.alpha.kubernetes.io/critical-pod: ''
89     spec:
90       tolerations:
91         # This taint is set by all kubelets running `--cloud-provider=external`
92         # so we should tolerate it to schedule the Calico pods
93         - key: node.cloudprovider.kubernetes.io/uninitialized
94           value: "true"
95           effect: NoSchedule
96         # Allow this pod to run on the master.
97         - key: node-role.kubernetes.io/master
98           effect: NoSchedule
99         # Allow this pod to be rescheduled while the node is in "critical add-ons only" mode.
100         # This, along with the annotation above marks this pod as a critical add-on.
101         - key: CriticalAddonsOnly
102           operator: Exists
103       # Only run this pod on the master.
104       nodeSelector:
105         node-role.kubernetes.io/master: ""
106         beta.kubernetes.io/arch: amd64
107       hostNetwork: true
108       containers:
109         - name: calico-etcd
110           image: quay.io/coreos/etcd:v3.3.9
111           env:
112             - name: CALICO_ETCD_IP
113               valueFrom:
114                 fieldRef:
115                   fieldPath: status.podIP
116           command:
117             - /usr/local/bin/etcd
118           args:
119             - --name=calico
120             - --data-dir=/var/etcd/calico-data
121             - --advertise-client-urls=http://$(CALICO_ETCD_IP):6666
122             - --listen-client-urls=http://0.0.0.0:6666
123             - --listen-peer-urls=http://0.0.0.0:6667
124             - --auto-compaction-retention=1
125           volumeMounts:
126             - name: var-etcd
127               mountPath: /var/etcd
128       volumes:
129         - name: var-etcd
130           hostPath:
131             path: /var/etcd
132
133 ---
134
135 # This manifest installs the Service which gets traffic to the Calico
136 # etcd.
137 apiVersion: v1
138 kind: Service
139 metadata:
140   labels:
141     k8s-app: calico-etcd
142   name: calico-etcd
143   namespace: kube-system
144 spec:
145   # Select the calico-etcd pod running on the master.
146   selector:
147     k8s-app: calico-etcd
148   # This ClusterIP needs to be known in advance, since we cannot rely
149   # on DNS to get access to etcd.
150   clusterIP: 10.96.232.136
151   ports:
152     - port: 6666