020-deployment.yaml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. ###############################
  2. # ServiceAccount
  3. ###############################
  4. ---
  5. apiVersion: v1
  6. kind: ServiceAccount
  7. metadata:
  8. name: traefik
  9. namespace: kube-system
  10. ###############################
  11. # Deployment
  12. ###############################
  13. ---
  14. apiVersion: apps/v1
  15. kind: Deployment
  16. metadata:
  17. labels:
  18. app: traefik
  19. release: traefik
  20. name: traefik
  21. namespace: kube-system
  22. spec:
  23. replicas: 1
  24. selector:
  25. matchLabels:
  26. app: traefik
  27. release: traefik
  28. template:
  29. metadata:
  30. labels:
  31. app: traefik
  32. release: traefik
  33. spec:
  34. containers:
  35. - args:
  36. - --api
  37. - --api.insecure=true
  38. # Set insecure to fals to enable basic auth
  39. #- --api.insecure=false
  40. - --api.dashboard=true
  41. - --accesslog
  42. - --global.checknewversion=true
  43. - --entryPoints.traefik.address=:8100
  44. - --entryPoints.web.address=:80
  45. - --entryPoints.websecure.address=:443
  46. # permanent redirecting of all requests on http (80) to https (443)
  47. - --entrypoints.web.http.redirections.entryPoint.to=websecure
  48. - --entrypoints.websecure.http.tls.certResolver=default
  49. #- --entrypoints.websecure.http.tls.certResolver=letsencrypt
  50. # Let's Encrypt Configurtion:
  51. # Please note that this is the staging Let's Encrypt server configuration.
  52. # Once you get things working, you should remove that following line.
  53. - --certificatesresolvers.default.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
  54. - --certificatesresolvers.default.acme.email=eugeniucarvalho@gmail.com
  55. - --certificatesresolvers.default.acme.storage=/var/lib/traefik/acme.json
  56. - --certificatesresolvers.default.acme.tlschallenge=true
  57. - --ping=true
  58. - --providers.kubernetescrd=true
  59. - --providers.kubernetesingress=true
  60. # Use log level= INFO or DEBUG
  61. - --log.level=INFO
  62. image: traefik:2.2.1
  63. imagePullPolicy: IfNotPresent
  64. livenessProbe:
  65. failureThreshold: 3
  66. httpGet:
  67. path: /ping
  68. port: 8100
  69. scheme: HTTP
  70. initialDelaySeconds: 10
  71. periodSeconds: 10
  72. successThreshold: 1
  73. timeoutSeconds: 2
  74. name: traefik
  75. ports:
  76. - containerPort: 8100
  77. name: admin
  78. protocol: TCP
  79. - containerPort: 80
  80. name: web
  81. protocol: TCP
  82. - containerPort: 443
  83. name: websecure
  84. protocol: TCP
  85. # optional storage
  86. # enable this option only in case you have defined a persistence volume claim
  87. #volumeMounts:
  88. #- name: traefik-data
  89. # mountPath: /var/lib/traefik
  90. readinessProbe:
  91. failureThreshold: 1
  92. httpGet:
  93. path: /ping
  94. port: 8100
  95. scheme: HTTP
  96. initialDelaySeconds: 10
  97. periodSeconds: 10
  98. successThreshold: 1
  99. timeoutSeconds: 2
  100. resources: {}
  101. terminationMessagePath: /dev/termination-log
  102. terminationMessagePolicy: File
  103. dnsPolicy: ClusterFirst
  104. restartPolicy: Always
  105. schedulerName: default-scheduler
  106. securityContext: {}
  107. serviceAccount: traefik
  108. serviceAccountName: traefik
  109. terminationGracePeriodSeconds: 60
  110. # optional storage
  111. # enable this option only in case you have defined a persistence volume claim
  112. #volumes:
  113. # - name: traefik-data
  114. # persistentVolumeClaim:
  115. # claimName: traefik-data
  116. ###############################
  117. # Service
  118. ###############################
  119. ---
  120. apiVersion: v1
  121. kind: Service
  122. metadata:
  123. labels:
  124. app: traefik
  125. release: traefik
  126. name: traefik
  127. namespace: kube-system
  128. spec:
  129. externalIPs:
  130. - "10.128.0.8"
  131. externalTrafficPolicy: Cluster
  132. ports:
  133. - name: web
  134. port: 80
  135. protocol: TCP
  136. targetPort: 80
  137. - name: websecure
  138. port: 443
  139. protocol: TCP
  140. targetPort: 443
  141. - name: admin
  142. port: 8100
  143. protocol: TCP
  144. targetPort: 8100
  145. selector:
  146. app: traefik
  147. release: traefik
  148. sessionAffinity: None
  149. type: LoadBalancer
  150. status:
  151. loadBalancer: {}
  152. #########################################################
  153. # The Middleware configuration contains middleware componenst
  154. # for a HTTP->HTTS redirection and a BasicAuth example.
  155. #########################################################
  156. ###############################
  157. # Middleware for basicAuth
  158. ###############################
  159. ---
  160. apiVersion: traefik.containo.us/v1alpha1
  161. kind: Middleware
  162. metadata:
  163. name: basic-auth
  164. spec:
  165. basicAuth:
  166. secret: authsecret
  167. ---
  168. apiVersion: v1
  169. kind: Secret
  170. metadata:
  171. name: authsecret
  172. namespace: default
  173. #------------ Paste your own password file content here (default user/password=admin/adminadmin)--------------
  174. data:
  175. users: |2
  176. YWRtaW46JGFwcjEkWXdmLkF6Um0kc3owTkpQMi55cy56V2svek43aENtLwoKdXNl
  177. cjokYXByMSRaU2VKQW1pOSRVV1AvcDdsQy9KSzdrbXBIMXdGL28uCgo=
  178. ###############################
  179. # Middleware for HTTP->HTTPS
  180. # This middleware is not needed in case of:
  181. # entrypoints.web.http.redirections.entryPoint.to=websecure
  182. ###############################
  183. #---
  184. #apiVersion: traefik.containo.us/v1alpha1
  185. #kind: Middleware
  186. #metadata:
  187. # name: https-redirect
  188. #spec:
  189. # redirectScheme:
  190. # scheme: https
  191. # permanent: true
  192. # #port: 443
  193. ###############################
  194. # Middleware for CORS
  195. ###############################
  196. ---
  197. apiVersion: traefik.containo.us/v1alpha1
  198. kind: Middleware
  199. metadata:
  200. name: cors-all
  201. spec:
  202. headers:
  203. accessControlAllowMethods:
  204. - "GET"
  205. - "OPTIONS"
  206. - "PUT"
  207. - "POST"
  208. accessControlAllowOriginList:
  209. - "origin-list-or-null"
  210. accessControlMaxAge: 100
  211. accessControlAllowHeaders:
  212. - "Content-Type"
  213. addVaryHeader: true
  214. customRequestHeaders:
  215. X-Forwarded-Proto: "https"