nginx-gateway.yaml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. apiVersion: v1
  2. kind: Namespace
  3. metadata:
  4. name: nginx-gateway
  5. ---
  6. # Source: nginx-gateway-fabric/templates/rbac.yaml
  7. apiVersion: v1
  8. kind: ServiceAccount
  9. metadata:
  10. name: nginx-gateway
  11. namespace: nginx-gateway
  12. labels:
  13. app.kubernetes.io/name: nginx-gateway
  14. app.kubernetes.io/instance: nginx-gateway
  15. app.kubernetes.io/version: "1.1.0"
  16. annotations:
  17. {}
  18. ---
  19. # Source: nginx-gateway-fabric/templates/rbac.yaml
  20. apiVersion: rbac.authorization.k8s.io/v1
  21. kind: ClusterRole
  22. metadata:
  23. name: nginx-gateway
  24. labels:
  25. app.kubernetes.io/name: nginx-gateway
  26. app.kubernetes.io/instance: nginx-gateway
  27. app.kubernetes.io/version: "1.1.0"
  28. rules:
  29. - apiGroups:
  30. - ""
  31. resources:
  32. - namespaces
  33. - services
  34. - secrets
  35. verbs:
  36. - list
  37. - watch
  38. - apiGroups:
  39. - ""
  40. resources:
  41. - events
  42. verbs:
  43. - create
  44. - patch
  45. - apiGroups:
  46. - discovery.k8s.io
  47. resources:
  48. - endpointslices
  49. verbs:
  50. - list
  51. - watch
  52. - apiGroups:
  53. - gateway.networking.k8s.io
  54. resources:
  55. - gatewayclasses
  56. - gateways
  57. - httproutes
  58. - referencegrants
  59. verbs:
  60. - list
  61. - watch
  62. - apiGroups:
  63. - gateway.networking.k8s.io
  64. resources:
  65. - httproutes/status
  66. - gateways/status
  67. - gatewayclasses/status
  68. verbs:
  69. - update
  70. - apiGroups:
  71. - gateway.nginx.org
  72. resources:
  73. - nginxgateways
  74. verbs:
  75. - get
  76. - list
  77. - watch
  78. - apiGroups:
  79. - gateway.nginx.org
  80. resources:
  81. - nginxgateways/status
  82. verbs:
  83. - update
  84. - apiGroups:
  85. - coordination.k8s.io
  86. resources:
  87. - leases
  88. verbs:
  89. - create
  90. - get
  91. - update
  92. - apiGroups:
  93. - apiextensions.k8s.io
  94. resources:
  95. - customresourcedefinitions
  96. verbs:
  97. - list
  98. - watch
  99. ---
  100. # Source: nginx-gateway-fabric/templates/rbac.yaml
  101. apiVersion: rbac.authorization.k8s.io/v1
  102. kind: ClusterRoleBinding
  103. metadata:
  104. name: nginx-gateway
  105. labels:
  106. app.kubernetes.io/name: nginx-gateway
  107. app.kubernetes.io/instance: nginx-gateway
  108. app.kubernetes.io/version: "1.1.0"
  109. roleRef:
  110. apiGroup: rbac.authorization.k8s.io
  111. kind: ClusterRole
  112. name: nginx-gateway
  113. subjects:
  114. - kind: ServiceAccount
  115. name: nginx-gateway
  116. namespace: nginx-gateway
  117. ---
  118. # Source: nginx-gateway-fabric/templates/deployment.yaml
  119. apiVersion: apps/v1
  120. kind: Deployment
  121. metadata:
  122. name: nginx-gateway
  123. namespace: nginx-gateway
  124. labels:
  125. app.kubernetes.io/name: nginx-gateway
  126. app.kubernetes.io/instance: nginx-gateway
  127. app.kubernetes.io/version: "1.1.0"
  128. spec:
  129. replicas: 1
  130. selector:
  131. matchLabels:
  132. app.kubernetes.io/name: nginx-gateway
  133. app.kubernetes.io/instance: nginx-gateway
  134. template:
  135. metadata:
  136. labels:
  137. app.kubernetes.io/name: nginx-gateway
  138. app.kubernetes.io/instance: nginx-gateway
  139. annotations:
  140. prometheus.io/scrape: "true"
  141. prometheus.io/port: "9113"
  142. spec:
  143. containers:
  144. - args:
  145. - static-mode
  146. - --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
  147. - --gatewayclass=nginx
  148. - --config=nginx-gateway-config
  149. - --service=nginx-gateway
  150. - --metrics-port=9113
  151. - --health-port=8081
  152. - --leader-election-lock-name=nginx-gateway-leader-election
  153. env:
  154. - name: POD_IP
  155. valueFrom:
  156. fieldRef:
  157. fieldPath: status.podIP
  158. - name: POD_NAMESPACE
  159. valueFrom:
  160. fieldRef:
  161. fieldPath: metadata.namespace
  162. - name: POD_NAME
  163. valueFrom:
  164. fieldRef:
  165. fieldPath: metadata.name
  166. image: ghcr.io/nginxinc/nginx-gateway-fabric:1.1.0
  167. imagePullPolicy: IfNotPresent
  168. name: nginx-gateway
  169. ports:
  170. - name: metrics
  171. containerPort: 9113
  172. - name: health
  173. containerPort: 8081
  174. readinessProbe:
  175. httpGet:
  176. path: /readyz
  177. port: health
  178. initialDelaySeconds: 3
  179. periodSeconds: 1
  180. securityContext:
  181. allowPrivilegeEscalation: false
  182. capabilities:
  183. add:
  184. - KILL
  185. drop:
  186. - ALL
  187. readOnlyRootFilesystem: true
  188. runAsUser: 102
  189. runAsGroup: 1001
  190. volumeMounts:
  191. - name: nginx-conf
  192. mountPath: /etc/nginx/conf.d
  193. - name: nginx-secrets
  194. mountPath: /etc/nginx/secrets
  195. - name: nginx-run
  196. mountPath: /var/run/nginx
  197. - image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:1.1.0
  198. imagePullPolicy: IfNotPresent
  199. name: nginx
  200. ports:
  201. - containerPort: 80
  202. name: http
  203. - containerPort: 443
  204. name: https
  205. securityContext:
  206. capabilities:
  207. add:
  208. - NET_BIND_SERVICE
  209. drop:
  210. - ALL
  211. readOnlyRootFilesystem: true
  212. runAsUser: 101
  213. runAsGroup: 1001
  214. volumeMounts:
  215. - name: nginx-conf
  216. mountPath: /etc/nginx/conf.d
  217. - name: nginx-secrets
  218. mountPath: /etc/nginx/secrets
  219. - name: nginx-run
  220. mountPath: /var/run/nginx
  221. - name: nginx-cache
  222. mountPath: /var/cache/nginx
  223. - name: nginx-lib
  224. mountPath: /var/lib/nginx
  225. terminationGracePeriodSeconds: 30
  226. serviceAccountName: nginx-gateway
  227. shareProcessNamespace: true
  228. securityContext:
  229. fsGroup: 1001
  230. runAsNonRoot: true
  231. volumes:
  232. - name: nginx-conf
  233. emptyDir: {}
  234. - name: nginx-secrets
  235. emptyDir: {}
  236. - name: nginx-run
  237. emptyDir: {}
  238. - name: nginx-cache
  239. emptyDir: {}
  240. - name: nginx-lib
  241. emptyDir: {}
  242. ---
  243. # Source: nginx-gateway-fabric/templates/gatewayclass.yaml
  244. apiVersion: gateway.networking.k8s.io/v1
  245. kind: GatewayClass
  246. metadata:
  247. name: nginx
  248. labels:
  249. app.kubernetes.io/name: nginx-gateway
  250. app.kubernetes.io/instance: nginx-gateway
  251. app.kubernetes.io/version: "1.1.0"
  252. spec:
  253. controllerName: gateway.nginx.org/nginx-gateway-controller
  254. ---
  255. # Source: nginx-gateway-fabric/templates/nginxgateway.yaml
  256. apiVersion: gateway.nginx.org/v1alpha1
  257. kind: NginxGateway
  258. metadata:
  259. name: nginx-gateway-config
  260. namespace: nginx-gateway
  261. labels:
  262. app.kubernetes.io/name: nginx-gateway
  263. app.kubernetes.io/instance: nginx-gateway
  264. app.kubernetes.io/version: "1.1.0"
  265. spec:
  266. logging:
  267. level: info