You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

320 lines
6.0 KiB

  1. # Policy to ensure the API server isn't cut off. Can be modified, but ensure
  2. # that the main API server is always able to reach the Calico API server.
  3. kind: NetworkPolicy
  4. apiVersion: networking.k8s.io/v1
  5. metadata:
  6. name: allow-apiserver
  7. namespace: calico-apiserver
  8. spec:
  9. podSelector:
  10. matchLabels:
  11. apiserver: "true"
  12. ingress:
  13. - ports:
  14. - protocol: TCP
  15. port: 5443
  16. ---
  17. apiVersion: v1
  18. kind: Service
  19. metadata:
  20. name: calico-api
  21. namespace: calico-apiserver
  22. spec:
  23. ports:
  24. - name: apiserver
  25. port: 443
  26. protocol: TCP
  27. targetPort: 5443
  28. selector:
  29. apiserver: "true"
  30. type: ClusterIP
  31. ---
  32. apiVersion: apps/v1
  33. kind: Deployment
  34. metadata:
  35. labels:
  36. apiserver: "true"
  37. k8s-app: calico-apiserver
  38. name: calico-apiserver
  39. namespace: calico-apiserver
  40. spec:
  41. replicas: 1
  42. selector:
  43. matchLabels:
  44. apiserver: "true"
  45. strategy:
  46. type: Recreate
  47. template:
  48. metadata:
  49. labels:
  50. apiserver: "true"
  51. k8s-app: calico-apiserver
  52. name: calico-apiserver
  53. namespace: calico-apiserver
  54. spec:
  55. containers:
  56. - args:
  57. - --secure-port=5443
  58. - -v=5
  59. env:
  60. - name: DATASTORE_TYPE
  61. value: kubernetes
  62. image: {{ calico_apiserver_image_repo }}:{{ calico_apiserver_image_tag }}
  63. imagePullPolicy: {{ k8s_image_pull_policy }}
  64. livenessProbe:
  65. httpGet:
  66. path: /version
  67. port: 5443
  68. scheme: HTTPS
  69. initialDelaySeconds: 90
  70. periodSeconds: 10
  71. name: calico-apiserver
  72. readinessProbe:
  73. exec:
  74. command:
  75. - /code/filecheck
  76. failureThreshold: 5
  77. initialDelaySeconds: 5
  78. periodSeconds: 10
  79. securityContext:
  80. privileged: false
  81. runAsUser: 0
  82. volumeMounts:
  83. - mountPath: /code/apiserver.local.config/certificates
  84. name: calico-apiserver-certs
  85. dnsPolicy: ClusterFirst
  86. nodeSelector:
  87. kubernetes.io/os: linux
  88. restartPolicy: Always
  89. serviceAccount: calico-apiserver
  90. serviceAccountName: calico-apiserver
  91. tolerations:
  92. - effect: NoSchedule
  93. key: node-role.kubernetes.io/master
  94. volumes:
  95. - name: calico-apiserver-certs
  96. secret:
  97. secretName: calico-apiserver-certs
  98. ---
  99. apiVersion: v1
  100. kind: ServiceAccount
  101. metadata:
  102. name: calico-apiserver
  103. namespace: calico-apiserver
  104. ---
  105. # Cluster-scoped resources below here.
  106. apiVersion: apiregistration.k8s.io/v1
  107. kind: APIService
  108. metadata:
  109. name: v3.projectcalico.org
  110. spec:
  111. group: projectcalico.org
  112. groupPriorityMinimum: 1500
  113. caBundle: {{ calico_apiserver_cabundle }}
  114. service:
  115. name: calico-api
  116. namespace: calico-apiserver
  117. port: 443
  118. version: v3
  119. versionPriority: 200
  120. ---
  121. apiVersion: rbac.authorization.k8s.io/v1
  122. kind: ClusterRole
  123. metadata:
  124. name: calico-crds
  125. rules:
  126. - apiGroups:
  127. - extensions
  128. - networking.k8s.io
  129. - ""
  130. resources:
  131. - networkpolicies
  132. - nodes
  133. - namespaces
  134. - pods
  135. - serviceaccounts
  136. verbs:
  137. - get
  138. - list
  139. - watch
  140. - apiGroups:
  141. - crd.projectcalico.org
  142. resources:
  143. - globalnetworkpolicies
  144. - networkpolicies
  145. - clusterinformations
  146. - hostendpoints
  147. - globalnetworksets
  148. - networksets
  149. - bgpconfigurations
  150. - bgppeers
  151. - felixconfigurations
  152. - kubecontrollersconfigurations
  153. - ippools
  154. - ipreservations
  155. - ipamblocks
  156. - blockaffinities
  157. - caliconodestatuses
  158. verbs:
  159. - get
  160. - list
  161. - watch
  162. - create
  163. - update
  164. - delete
  165. - apiGroups:
  166. - policy
  167. resourceNames:
  168. - calico-apiserver
  169. resources:
  170. - podsecuritypolicies
  171. verbs:
  172. - use
  173. ---
  174. apiVersion: rbac.authorization.k8s.io/v1
  175. kind: ClusterRole
  176. metadata:
  177. name: calico-extension-apiserver-auth-access
  178. rules:
  179. - apiGroups:
  180. - ""
  181. resourceNames:
  182. - extension-apiserver-authentication
  183. resources:
  184. - configmaps
  185. verbs:
  186. - list
  187. - watch
  188. - get
  189. - apiGroups:
  190. - rbac.authorization.k8s.io
  191. resources:
  192. - clusterroles
  193. - clusterrolebindings
  194. - roles
  195. - rolebindings
  196. verbs:
  197. - get
  198. - list
  199. - watch
  200. ---
  201. apiVersion: rbac.authorization.k8s.io/v1
  202. kind: ClusterRole
  203. metadata:
  204. name: calico-webhook-reader
  205. rules:
  206. - apiGroups:
  207. - admissionregistration.k8s.io
  208. resources:
  209. - mutatingwebhookconfigurations
  210. - validatingwebhookconfigurations
  211. verbs:
  212. - get
  213. - list
  214. - watch
  215. ---
  216. apiVersion: rbac.authorization.k8s.io/v1
  217. kind: ClusterRoleBinding
  218. metadata:
  219. name: calico-apiserver-access-crds
  220. roleRef:
  221. apiGroup: rbac.authorization.k8s.io
  222. kind: ClusterRole
  223. name: calico-crds
  224. subjects:
  225. - kind: ServiceAccount
  226. name: calico-apiserver
  227. namespace: calico-apiserver
  228. ---
  229. apiVersion: rbac.authorization.k8s.io/v1
  230. kind: ClusterRoleBinding
  231. metadata:
  232. name: calico-apiserver-delegate-auth
  233. roleRef:
  234. apiGroup: rbac.authorization.k8s.io
  235. kind: ClusterRole
  236. name: system:auth-delegator
  237. subjects:
  238. - kind: ServiceAccount
  239. name: calico-apiserver
  240. namespace: calico-apiserver
  241. ---
  242. apiVersion: rbac.authorization.k8s.io/v1
  243. kind: ClusterRoleBinding
  244. metadata:
  245. name: calico-apiserver-webhook-reader
  246. roleRef:
  247. apiGroup: rbac.authorization.k8s.io
  248. kind: ClusterRole
  249. name: calico-webhook-reader
  250. subjects:
  251. - kind: ServiceAccount
  252. name: calico-apiserver
  253. namespace: calico-apiserver
  254. ---
  255. apiVersion: rbac.authorization.k8s.io/v1
  256. kind: ClusterRoleBinding
  257. metadata:
  258. name: calico-extension-apiserver-auth-access
  259. roleRef:
  260. apiGroup: rbac.authorization.k8s.io
  261. kind: ClusterRole
  262. name: calico-extension-apiserver-auth-access
  263. subjects:
  264. - kind: ServiceAccount
  265. name: calico-apiserver
  266. namespace: calico-apiserver
  267. ---
  268. apiVersion: policy/v1beta1
  269. kind: PodSecurityPolicy
  270. metadata:
  271. annotations:
  272. seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
  273. name: calico-apiserver
  274. spec:
  275. allowPrivilegeEscalation: false
  276. fsGroup:
  277. ranges:
  278. - max: 65535
  279. min: 1
  280. rule: MustRunAs
  281. hostPorts:
  282. - max: 65535
  283. min: 0
  284. requiredDropCapabilities:
  285. - ALL
  286. runAsUser:
  287. rule: RunAsAny
  288. seLinux:
  289. rule: RunAsAny
  290. supplementalGroups:
  291. ranges:
  292. - max: 65535
  293. min: 1
  294. rule: MustRunAs
  295. volumes:
  296. - secret