kubeasz/roles/flannel/templates/kube-flannel.yaml.j2

194 lines
4.1 KiB
Plaintext
Raw Normal View History

2017-12-30 20:19:50 +08:00
---
kind: ClusterRole
2019-10-19 22:25:42 +08:00
apiVersion: rbac.authorization.k8s.io/v1
2017-12-30 20:19:50 +08:00
metadata:
name: flannel
rules:
2021-12-30 13:43:37 +08:00
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- nodes/status
verbs:
- patch
2017-12-30 20:19:50 +08:00
---
kind: ClusterRoleBinding
2019-10-19 22:25:42 +08:00
apiVersion: rbac.authorization.k8s.io/v1
2017-12-30 20:19:50 +08:00
metadata:
name: flannel
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: flannel
subjects:
- kind: ServiceAccount
name: flannel
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: flannel
namespace: kube-system
---
kind: ConfigMap
apiVersion: v1
metadata:
name: kube-flannel-cfg
namespace: kube-system
labels:
tier: node
app: flannel
data:
cni-conf.json: |
{
"name": "cbr0",
2019-10-19 22:25:42 +08:00
"cniVersion": "0.3.1",
2017-12-30 20:19:50 +08:00
"plugins": [
{
"type": "flannel",
"delegate": {
"hairpinMode": true,
"isDefaultGateway": true
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
}
]
}
net-conf.json: |
{
2018-01-02 22:12:51 +08:00
"Network": "{{ CLUSTER_CIDR }}",
2017-12-30 20:19:50 +08:00
"Backend": {
{% if FLANNEL_BACKEND == "vxlan" and DIRECT_ROUTING %}
"DirectRouting": true,
{% endif %}
2018-01-04 22:50:09 +08:00
"Type": "{{ FLANNEL_BACKEND }}"
2017-12-30 20:19:50 +08:00
}
}
---
2019-10-19 22:25:42 +08:00
apiVersion: apps/v1
2017-12-30 20:19:50 +08:00
kind: DaemonSet
metadata:
2021-12-30 13:43:37 +08:00
name: kube-flannel-ds
2017-12-30 20:19:50 +08:00
namespace: kube-system
labels:
tier: node
app: flannel
spec:
2019-10-19 22:25:42 +08:00
selector:
matchLabels:
app: flannel
2017-12-30 20:19:50 +08:00
template:
metadata:
labels:
tier: node
app: flannel
spec:
2019-10-19 22:25:42 +08:00
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
2021-12-30 13:43:37 +08:00
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
2017-12-30 20:19:50 +08:00
hostNetwork: true
2021-12-30 13:43:37 +08:00
priorityClassName: system-node-critical
2017-12-30 20:19:50 +08:00
tolerations:
2019-02-15 14:47:43 +08:00
- operator: Exists
2017-12-30 20:19:50 +08:00
effect: NoSchedule
serviceAccountName: flannel
initContainers:
2022-09-15 19:53:06 +08:00
- name: install-cni-plugin
image: easzlab.io.local:5000/flannelcni/flannel-cni-plugin:v1.1.0
command:
- cp
args:
- -f
- /flannel
- /opt/cni/bin/flannel
volumeMounts:
- name: cni-plugin
mountPath: /opt/cni/bin
2017-12-30 20:19:50 +08:00
- name: install-cni
2022-09-15 19:53:06 +08:00
image: easzlab.io.local:5000/flannelcni/flannel:{{ flannel_ver }}
2017-12-30 20:19:50 +08:00
command:
- cp
args:
- -f
- /etc/kube-flannel/cni-conf.json
- /etc/cni/net.d/10-flannel.conflist
volumeMounts:
- name: cni
mountPath: /etc/cni/net.d
- name: flannel-cfg
mountPath: /etc/kube-flannel/
containers:
- name: kube-flannel
2022-09-15 19:53:06 +08:00
image: easzlab.io.local:5000/flannelcni/flannel:{{ flannel_ver }}
2017-12-30 20:19:50 +08:00
command:
- /opt/bin/flanneld
args:
- --ip-masq
- --kube-subnet-mgr
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
2019-10-19 22:25:42 +08:00
privileged: false
capabilities:
2021-12-30 13:43:37 +08:00
add: ["NET_ADMIN", "NET_RAW"]
2017-12-30 20:19:50 +08:00
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
2022-09-15 19:53:06 +08:00
- name: EVENT_QUEUE_DEPTH
value: "5000"
2017-12-30 20:19:50 +08:00
volumeMounts:
- name: run
2019-10-19 22:25:42 +08:00
mountPath: /run/flannel
2017-12-30 20:19:50 +08:00
- name: flannel-cfg
mountPath: /etc/kube-flannel/
2022-09-15 19:53:06 +08:00
- name: xtables-lock
mountPath: /run/xtables.lock
2017-12-30 20:19:50 +08:00
volumes:
2021-12-30 13:43:37 +08:00
- name: run
hostPath:
path: /run/flannel
2022-09-15 19:53:06 +08:00
- name: cni-plugin
hostPath:
path: {{ bin_dir }}
2021-12-30 13:43:37 +08:00
- name: cni
hostPath:
path: /etc/cni/net.d
- name: flannel-cfg
configMap:
name: kube-flannel-cfg