020-deployment.yaml 10 KB

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