2017-12-30 20:19:50 +08:00
|
|
|
---
|
|
|
|
kind: ClusterRole
|
2018-01-02 22:12:51 +08:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2017-12-30 20:19:50 +08:00
|
|
|
metadata:
|
|
|
|
name: flannel
|
|
|
|
rules:
|
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- pods
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- nodes
|
|
|
|
verbs:
|
|
|
|
- list
|
|
|
|
- watch
|
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- nodes/status
|
|
|
|
verbs:
|
|
|
|
- patch
|
|
|
|
---
|
|
|
|
kind: ClusterRoleBinding
|
2018-01-02 22:12:51 +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",
|
|
|
|
"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": {
|
2018-01-04 22:50:09 +08:00
|
|
|
"Type": "{{ FLANNEL_BACKEND }}"
|
2017-12-30 20:19:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
---
|
|
|
|
apiVersion: extensions/v1beta1
|
|
|
|
kind: DaemonSet
|
|
|
|
metadata:
|
|
|
|
name: kube-flannel-ds
|
|
|
|
namespace: kube-system
|
|
|
|
labels:
|
|
|
|
tier: node
|
|
|
|
app: flannel
|
|
|
|
spec:
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
tier: node
|
|
|
|
app: flannel
|
|
|
|
spec:
|
|
|
|
hostNetwork: true
|
|
|
|
nodeSelector:
|
|
|
|
beta.kubernetes.io/arch: amd64
|
|
|
|
tolerations:
|
|
|
|
- key: node-role.kubernetes.io/master
|
|
|
|
operator: Exists
|
|
|
|
effect: NoSchedule
|
|
|
|
serviceAccountName: flannel
|
|
|
|
initContainers:
|
|
|
|
- name: install-cni
|
2018-06-09 17:57:17 +08:00
|
|
|
image: {{ install_cni_image }}
|
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
|
2018-06-09 17:57:17 +08:00
|
|
|
image: {{ flanneld_image }}
|
2017-12-30 20:19:50 +08:00
|
|
|
command:
|
|
|
|
- /opt/bin/flanneld
|
|
|
|
args:
|
|
|
|
- --ip-masq
|
|
|
|
- --kube-subnet-mgr
|
2018-04-16 21:03:52 +08:00
|
|
|
#- --iface=eth1
|
2017-12-30 20:19:50 +08:00
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
cpu: "100m"
|
|
|
|
memory: "50Mi"
|
|
|
|
limits:
|
|
|
|
cpu: "100m"
|
|
|
|
memory: "50Mi"
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
env:
|
|
|
|
- name: POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: POD_NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
2018-04-17 21:02:44 +08:00
|
|
|
- name: KUBERNETES_SERVICE_HOST
|
2018-04-19 08:48:44 +08:00
|
|
|
value: "{{ MASTER_IP }}"
|
|
|
|
#value: "{{ KUBE_APISERVER.split(':')[1].lstrip('/') }}"
|
2018-04-17 21:02:44 +08:00
|
|
|
- name: KUBERNETES_SERVICE_PORT
|
2018-04-19 08:48:44 +08:00
|
|
|
value: "{{ KUBE_APISERVER.split(':')[2] }}"
|
2017-12-30 20:19:50 +08:00
|
|
|
volumeMounts:
|
|
|
|
- name: run
|
|
|
|
mountPath: /run
|
|
|
|
- name: flannel-cfg
|
|
|
|
mountPath: /etc/kube-flannel/
|
|
|
|
volumes:
|
|
|
|
- name: run
|
|
|
|
hostPath:
|
|
|
|
path: /run
|
|
|
|
- name: cni
|
|
|
|
hostPath:
|
|
|
|
path: /etc/cni/net.d
|
|
|
|
- name: flannel-cfg
|
|
|
|
configMap:
|
|
|
|
name: kube-flannel-cfg
|