1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
---
kind: ConfigMap
apiVersion: v1
metadata:
name: kube-2flannel-cfg1
namespace: "{{system_namespace}}"
labels:
tier: node
app: 2flannel
data:
cni-conf.json: |
{
"name": "2flannel-networks",
"type": "multus",
"delegates": [
{
"type": "flannel",
"name": "flannel1",
"subnetFile": "/run/2flannel/networks/subnet2.env",
"dataDir": "/var/lib/cni/flannel/2",
"delegate": {
"bridge": "kbr1",
"isDefaultGateway": false
}
},
{
"type": "flannel",
"name": "flannel0",
"subnetFile": "/run/2flannel/networks/subnet1.env",
"dataDir": "/var/lib/cni/flannel/1",
"masterplugin": true,
"delegate": {
"bridge": "kbr0",
"isDefaultGateway": true
}
}
]
}
net-conf.json: |
{
"Network": {{ two_flannel_network1 }},
"Backend": {
"Type": "udp",
"Port": 8285
}
}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: kube-2flannel-cfg2
namespace: "{{system_namespace}}"
labels:
tier: node
app: 2flannel
data:
net-conf.json: |
{
"Network": {{ two_flannel_network2 }},
"Backend": {
"Type": "udp",
"Port": 8286
}
}
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: kube-2flannel
namespace: "{{system_namespace}}"
labels:
tier: node
k8s-app: 2flannel
spec:
template:
metadata:
labels:
tier: node
k8s-app: 2flannel
spec:
{% if rbac_enabled %}
serviceAccountName: 2flannel
{% endif %}
containers:
- name: kube-2flannel-1
image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
resources:
limits:
cpu: {{ flannel_cpu_limit }}
memory: {{ flannel_memory_limit }}
requests:
cpu: {{ flannel_cpu_requests }}
memory: {{ flannel_memory_requests }}
command: [ "/opt/bin/flanneld", "--ip-masq",
"-etcd-endpoints={{ etcd_access_addresses }}",
"-etcd-prefix=/{{ cluster_name }}/2flannel.1/network",
"-etcd-cafile=/etc/ssl/etcd/ssl/ca.pem",
"-etcd-certfile=/etc/ssl/etcd/ssl/node-$(NODE_NAME).pem",
"-etcd-keyfile=/etc/ssl/etcd/ssl/node-$(NODE_NAME)-key.pem",
"-subnet-file=/run/2flannel/networks/subnet1.env" ]
securityContext:
privileged: true
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: run
mountPath: /run
- name: cni
mountPath: /etc/cni/net.d
- name: ssl
mountPath: /etc/ssl/etcd/ssl/
- name: 2flannel-cfg1
mountPath: /etc/kube-flannel/
- name: kube-2flannel-2
image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
resources:
limits:
cpu: {{ flannel_cpu_limit }}
memory: {{ flannel_memory_limit }}
requests:
cpu: {{ flannel_cpu_requests }}
memory: {{ flannel_memory_requests }}
command: [ "/opt/bin/flanneld", "--ip-masq",
"-etcd-endpoints={{ etcd_access_addresses }}",
"-etcd-prefix=/{{ cluster_name }}/2flannel.2/network",
"-etcd-cafile=/etc/ssl/etcd/ssl/ca.pem",
"-etcd-certfile=/etc/ssl/etcd/ssl/node-$(NODE_NAME).pem",
"-etcd-keyfile=/etc/ssl/etcd/ssl/node-$(NODE_NAME)-key.pem",
"-subnet-file=/run/2flannel/networks/subnet2.env" ]
securityContext:
privileged: true
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: run
mountPath: /run
- name: cni
mountPath: /etc/cni/net.d
- name: ssl
mountPath: /etc/ssl/etcd/ssl/
- name: 2flannel-cfg2
mountPath: /etc/kube-flannel/
- name: install-cni
image: {{ flannel_cni_image_repo }}:{{ flannel_cni_image_tag }}
command: ["/install-cni.sh"]
env:
# The CNI network config to install on each node.
- name: CNI_NETWORK_CONFIG
valueFrom:
configMapKeyRef:
name: kube-2flannel-cfg1
key: cni-conf.json
- name: CNI_CONF_NAME
value: "10-multus-2flannel.conf"
volumeMounts:
- name: cni
mountPath: /host/etc/cni/net.d
- name: host-cni-bin
mountPath: /host/opt/cni/bin/
hostNetwork: true
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
volumes:
- name: run
hostPath:
path: /run
- name: cni
hostPath:
path: /etc/cni/net.d
- name: ssl
hostPath:
path: /etc/ssl/etcd/ssl/
- name: 2flannel-cfg1
configMap:
name: kube-2flannel-cfg1
- name: 2flannel-cfg2
configMap:
name: kube-2flannel-cfg2
- name: host-cni-bin
hostPath:
path: /opt/cni/bin
updateStrategy:
rollingUpdate:
maxUnavailable: {{ serial | default('20%') }}
type: RollingUpdate
|