github.phpd.cn/cilium/cilium@v1.6.12/examples/kubernetes/addons/flannel/flannel.yaml (about)

     1  ---
     2  kind: ClusterRole
     3  apiVersion: rbac.authorization.k8s.io/v1beta1
     4  metadata:
     5    name: flannel
     6  rules:
     7    - apiGroups:
     8        - ""
     9      resources:
    10        - pods
    11      verbs:
    12        - get
    13    - apiGroups:
    14        - ""
    15      resources:
    16        - nodes
    17      verbs:
    18        - list
    19        - watch
    20    - apiGroups:
    21        - ""
    22      resources:
    23        - nodes/status
    24      verbs:
    25        - patch
    26  ---
    27  kind: ClusterRoleBinding
    28  apiVersion: rbac.authorization.k8s.io/v1beta1
    29  metadata:
    30    name: flannel
    31  roleRef:
    32    apiGroup: rbac.authorization.k8s.io
    33    kind: ClusterRole
    34    name: flannel
    35  subjects:
    36  - kind: ServiceAccount
    37    name: flannel
    38    namespace: kube-system
    39  ---
    40  apiVersion: v1
    41  kind: ServiceAccount
    42  metadata:
    43    name: flannel
    44    namespace: kube-system
    45  ---
    46  kind: ConfigMap
    47  apiVersion: v1
    48  metadata:
    49    name: kube-flannel-cfg
    50    namespace: kube-system
    51    labels:
    52      tier: node
    53      app: flannel
    54  data:
    55    cni-conf.json: |
    56      {
    57        "name": "cbr0",
    58        "plugins": [
    59          {
    60            "type": "flannel",
    61            "delegate": {
    62              "hairpinMode": true,
    63              "isDefaultGateway": true
    64            }
    65          },
    66          {
    67            "type": "portmap",
    68            "capabilities": {
    69              "portMappings": true
    70            }
    71          }
    72        ]
    73      }
    74    net-conf.json: |
    75      {
    76        "Network": "10.244.0.0/16",
    77        "Backend": {
    78          "Type": "vxlan"
    79        }
    80      }
    81  ---
    82  apiVersion: apps/v1
    83  kind: DaemonSet
    84  metadata:
    85    name: kube-flannel-ds-amd64
    86    namespace: kube-system
    87    labels:
    88      tier: node
    89      app: flannel
    90  spec:
    91    selector:
    92      matchLabels:
    93        tier: node
    94        app: flannel
    95    template:
    96      metadata:
    97        labels:
    98          tier: node
    99          app: flannel
   100      spec:
   101        hostNetwork: true
   102        nodeSelector:
   103          beta.kubernetes.io/arch: amd64
   104        tolerations:
   105        - operator: Exists
   106          effect: NoSchedule
   107        serviceAccountName: flannel
   108        initContainers:
   109        - name: install-cni
   110          image: quay.io/coreos/flannel:v0.10.0-amd64
   111          command:
   112          - cp
   113          args:
   114          - -f
   115          - /etc/kube-flannel/cni-conf.json
   116          - /etc/cni/net.d/10-flannel.conflist
   117          volumeMounts:
   118          - name: cni
   119            mountPath: /etc/cni/net.d
   120          - name: flannel-cfg
   121            mountPath: /etc/kube-flannel/
   122        containers:
   123        - name: kube-flannel
   124          image: quay.io/coreos/flannel:v0.10.0-amd64
   125          command:
   126          - /opt/bin/flanneld
   127          args:
   128          - --ip-masq
   129          - --kube-subnet-mgr
   130          - -iface=enp0s8
   131          resources:
   132            requests:
   133              cpu: "100m"
   134              memory: "50Mi"
   135            limits:
   136              cpu: "100m"
   137              memory: "50Mi"
   138          securityContext:
   139            privileged: true
   140          env:
   141          - name: POD_NAME
   142            valueFrom:
   143              fieldRef:
   144                fieldPath: metadata.name
   145          - name: POD_NAMESPACE
   146            valueFrom:
   147              fieldRef:
   148                fieldPath: metadata.namespace
   149          volumeMounts:
   150          - name: run
   151            mountPath: /run
   152          - name: flannel-cfg
   153            mountPath: /etc/kube-flannel/
   154        volumes:
   155          - name: run
   156            hostPath:
   157              path: /run
   158          - name: cni
   159            hostPath:
   160              path: /etc/cni/net.d
   161          - name: flannel-cfg
   162            configMap:
   163              name: kube-flannel-cfg