Advertisement
pup_seba

haproxy configuration

Feb 18th, 2020
1,299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. ---
  2. apiVersion: v1
  3. kind: Namespace
  4. metadata:
  5. name: haproxy-controller
  6.  
  7. ---
  8. apiVersion: v1
  9. kind: ServiceAccount
  10. metadata:
  11. name: haproxy-ingress-service-account
  12. namespace: haproxy-controller
  13.  
  14. ---
  15. kind: ClusterRole
  16. apiVersion: rbac.authorization.k8s.io/v1
  17. metadata:
  18. name: haproxy-ingress-cluster-role
  19. rules:
  20. - apiGroups:
  21. - ""
  22. resources:
  23. - configmaps
  24. - endpoints
  25. - nodes
  26. - pods
  27. - services
  28. - namespaces
  29. - events
  30. - serviceaccounts
  31. verbs:
  32. - get
  33. - list
  34. - watch
  35. - apiGroups:
  36. - "extensions"
  37. resources:
  38. - ingresses
  39. - ingresses/status
  40. verbs:
  41. - get
  42. - list
  43. - watch
  44. - apiGroups:
  45. - ""
  46. resources:
  47. - secrets
  48. verbs:
  49. - get
  50. - list
  51. - watch
  52. - create
  53. - patch
  54. - update
  55. - apiGroups:
  56. - extensions
  57. resources:
  58. - ingresses
  59. verbs:
  60. - get
  61. - list
  62. - watch
  63.  
  64. ---
  65. kind: ClusterRoleBinding
  66. apiVersion: rbac.authorization.k8s.io/v1
  67. metadata:
  68. name: haproxy-ingress-cluster-role-binding
  69. namespace: haproxy-controller
  70. roleRef:
  71. apiGroup: rbac.authorization.k8s.io
  72. kind: ClusterRole
  73. name: haproxy-ingress-cluster-role
  74. subjects:
  75. - kind: ServiceAccount
  76. name: haproxy-ingress-service-account
  77. namespace: haproxy-controller
  78.  
  79. ---
  80. apiVersion: v1
  81. kind: ConfigMap
  82. metadata:
  83. name: haproxy-configmap
  84. namespace: default
  85. data:
  86.  
  87. ---
  88. apiVersion: apps/v1
  89. kind: Deployment
  90. metadata:
  91. labels:
  92. run: ingress-default-backend
  93. name: ingress-default-backend
  94. namespace: haproxy-controller
  95. spec:
  96. replicas: 1
  97. selector:
  98. matchLabels:
  99. run: ingress-default-backend
  100. template:
  101. metadata:
  102. labels:
  103. run: ingress-default-backend
  104. spec:
  105. containers:
  106. - name: ingress-default-backend
  107. image: gcr.io/google_containers/defaultbackend:1.0
  108. ports:
  109. - containerPort: 8080
  110.  
  111. ---
  112. apiVersion: v1
  113. kind: Service
  114. metadata:
  115. labels:
  116. run: ingress-default-backend
  117. name: ingress-default-backend
  118. namespace: haproxy-controller
  119. spec:
  120. selector:
  121. run: ingress-default-backend
  122. ports:
  123. - name: port-1
  124. port: 8080
  125. protocol: TCP
  126. targetPort: 8080
  127.  
  128. ---
  129. apiVersion: apps/v1
  130. kind: Deployment
  131. metadata:
  132. labels:
  133. run: haproxy-ingress
  134. name: haproxy-ingress
  135. namespace: haproxy-controller
  136. spec:
  137. replicas: 1
  138. selector:
  139. matchLabels:
  140. run: haproxy-ingress
  141. template:
  142. metadata:
  143. labels:
  144. run: haproxy-ingress
  145. spec:
  146. serviceAccountName: haproxy-ingress-service-account
  147. containers:
  148. - name: haproxy-ingress
  149. image: haproxytech/kubernetes-ingress
  150. args:
  151. - --configmap=default/haproxy-configmap
  152. - --default-backend-service=haproxy-controller/ingress-default-backend
  153. resources:
  154. requests:
  155. cpu: "500m"
  156. memory: "50Mi"
  157. livenessProbe:
  158. httpGet:
  159. path: /healthz
  160. port: 1042
  161. ports:
  162. - name: http
  163. containerPort: 80
  164. - name: https
  165. containerPort: 443
  166. - name: stat
  167. containerPort: 1024
  168. env:
  169. - name: POD_NAME
  170. valueFrom:
  171. fieldRef:
  172. fieldPath: metadata.name
  173. - name: POD_NAMESPACE
  174. valueFrom:
  175. fieldRef:
  176. fieldPath: metadata.namespace
  177.  
  178. ---
  179. apiVersion: v1
  180. kind: Service
  181. metadata:
  182. labels:
  183. run: haproxy-ingress
  184. name: haproxy-ingress
  185. namespace: haproxy-controller
  186. spec:
  187. selector:
  188. run: haproxy-ingress
  189. type: NodePort
  190. ports:
  191. - name: http
  192. port: 80
  193. protocol: TCP
  194. targetPort: 80
  195. - name: https
  196. port: 443
  197. protocol: TCP
  198. targetPort: 443
  199. - name: stat
  200. port: 1024
  201. protocol: TCP
  202. targetPort: 1024
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement