020-deployment.yaml 10 KB

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