020-deployment.yaml 10 KB

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