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

215 lines
4.4 KiB
Plaintext
Raw Normal View History

2017-12-30 20:19:50 +08:00
---
2023-04-24 20:01:19 +08:00
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: flannel
name: flannel
namespace: kube-system
---
2019-10-19 22:25:42 +08:00
apiVersion: rbac.authorization.k8s.io/v1
2023-04-24 20:01:19 +08:00
kind: ClusterRole
2017-12-30 20:19:50 +08:00
metadata:
2023-04-24 20:01:19 +08:00
labels:
k8s-app: flannel
2017-12-30 20:19:50 +08:00
name: flannel
rules:
2021-12-30 13:43:37 +08:00
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- apiGroups:
- ""
resources:
- nodes
verbs:
2023-04-24 20:01:19 +08:00
- get
2021-12-30 13:43:37 +08:00
- list
- watch
- apiGroups:
- ""
resources:
- nodes/status
verbs:
- patch
2023-04-24 20:01:19 +08:00
- apiGroups:
- networking.k8s.io
resources:
- clustercidrs
verbs:
- list
- watch
2017-12-30 20:19:50 +08:00
---
2019-10-19 22:25:42 +08:00
apiVersion: rbac.authorization.k8s.io/v1
2023-04-24 20:01:19 +08:00
kind: ClusterRoleBinding
2017-12-30 20:19:50 +08:00
metadata:
2023-04-24 20:01:19 +08:00
labels:
k8s-app: flannel
2017-12-30 20:19:50 +08:00
name: flannel
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: flannel
subjects:
- kind: ServiceAccount
name: flannel
namespace: kube-system
---
apiVersion: v1
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
}
}
2023-04-24 20:01:19 +08:00
kind: ConfigMap
metadata:
labels:
app: flannel
k8s-app: flannel
tier: node
name: kube-flannel-cfg
namespace: kube-system
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:
labels:
app: flannel
2023-04-24 20:01:19 +08:00
k8s-app: flannel
tier: node
name: kube-flannel-ds
namespace: kube-system
2017-12-30 20:19:50 +08:00
spec:
2019-10-19 22:25:42 +08:00
selector:
matchLabels:
app: flannel
2023-04-24 20:01:19 +08:00
k8s-app: flannel
2017-12-30 20:19:50 +08:00
template:
metadata:
labels:
app: flannel
2023-04-24 20:01:19 +08:00
k8s-app: flannel
tier: node
2017-12-30 20:19:50 +08:00
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
containers:
2023-04-24 20:01:19 +08:00
- args:
2017-12-30 20:19:50 +08:00
- --ip-masq
- --kube-subnet-mgr
2023-04-24 20:01:19 +08:00
command:
- /opt/bin/flanneld
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"
2023-04-24 20:01:19 +08:00
image: easzlab.io.local:5000/flannel/flannel:{{ flannel_ver }}
name: kube-flannel
resources:
requests:
cpu: 100m
memory: 50Mi
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
privileged: false
2017-12-30 20:19:50 +08:00
volumeMounts:
2023-04-24 20:01:19 +08:00
- mountPath: /run/flannel
name: run
- mountPath: /etc/kube-flannel/
name: flannel-cfg
- mountPath: /run/xtables.lock
name: xtables-lock
hostNetwork: true
initContainers:
- args:
- -f
- /flannel
- /opt/cni/bin/flannel
command:
- cp
image: easzlab.io.local:5000/flannel/flannel-cni-plugin:v1.1.2
name: install-cni-plugin
volumeMounts:
- mountPath: /opt/cni/bin
name: cni-plugin
- args:
- -f
- /etc/kube-flannel/cni-conf.json
- /etc/cni/net.d/10-flannel.conflist
command:
- cp
image: easzlab.io.local:5000/flannel/flannel:{{ flannel_ver }}
name: install-cni
volumeMounts:
- mountPath: /etc/cni/net.d
name: cni
- mountPath: /etc/kube-flannel/
name: flannel-cfg
priorityClassName: system-node-critical
serviceAccountName: flannel
tolerations:
- effect: NoSchedule
operator: Exists
2017-12-30 20:19:50 +08:00
volumes:
2023-04-24 20:01:19 +08:00
- hostPath:
2021-12-30 13:43:37 +08:00
path: /run/flannel
2023-04-24 20:01:19 +08:00
name: run
- hostPath:
path: /opt/cni/bin
name: cni-plugin
- hostPath:
2021-12-30 13:43:37 +08:00
path: /etc/cni/net.d
2023-04-24 20:01:19 +08:00
name: cni
- configMap:
2021-12-30 13:43:37 +08:00
name: kube-flannel-cfg
2023-04-24 20:01:19 +08:00
name: flannel-cfg
- hostPath:
2022-09-15 22:22:53 +08:00
path: /run/xtables.lock
type: FileOrCreate
2023-04-24 20:01:19 +08:00
name: xtables-lock