kube-flannel-aliyun.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. "type": "flannel",
  59. "delegate": {
  60. "hairpinMode": true,
  61. "isDefaultGateway": true
  62. }
  63. }
  64. net-conf.json: |
  65. {
  66. "Network": "10.24.0.0/16",
  67. "Backend": {
  68. "Type": "ali-vpc"
  69. }
  70. }
  71. ---
  72. apiVersion: extensions/v1beta1
  73. kind: DaemonSet
  74. metadata:
  75. name: kube-flannel-ds
  76. namespace: kube-system
  77. labels:
  78. tier: node
  79. app: flannel
  80. spec:
  81. template:
  82. metadata:
  83. labels:
  84. tier: node
  85. app: flannel
  86. spec:
  87. hostNetwork: true
  88. nodeSelector:
  89. beta.kubernetes.io/arch: amd64
  90. tolerations:
  91. - key: node-role.kubernetes.io/master
  92. operator: Exists
  93. effect: NoSchedule
  94. serviceAccountName: flannel
  95. initContainers:
  96. - name: install-cni
  97. image: registry.cn-hangzhou.aliyuncs.com/google-containers/flannel:v0.9.0
  98. command:
  99. - cp
  100. args:
  101. - -f
  102. - /etc/kube-flannel/cni-conf.json
  103. - /etc/cni/net.d/10-flannel.conf
  104. volumeMounts:
  105. - name: cni
  106. mountPath: /etc/cni/net.d
  107. - name: flannel-cfg
  108. mountPath: /etc/kube-flannel/
  109. containers:
  110. - name: kube-flannel
  111. image: registry.cn-hangzhou.aliyuncs.com/google-containers/flannel:v0.9.0
  112. command:
  113. - /opt/bin/flanneld
  114. args:
  115. - --ip-masq
  116. - --kube-subnet-mgr
  117. securityContext:
  118. privileged: true
  119. env:
  120. - name: POD_NAME
  121. valueFrom:
  122. fieldRef:
  123. fieldPath: metadata.name
  124. - name: POD_NAMESPACE
  125. valueFrom:
  126. fieldRef:
  127. fieldPath: metadata.namespace
  128. volumeMounts:
  129. - name: run
  130. mountPath: /run
  131. - name: flannel-cfg
  132. mountPath: /etc/kube-flannel/
  133. volumes:
  134. - name: run
  135. hostPath:
  136. path: /run
  137. - name: cni
  138. hostPath:
  139. path: /etc/cni/net.d
  140. - name: flannel-cfg
  141. configMap:
  142. name: kube-flannel-cfg