020-deployment.yaml 5.7 KB

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