-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path00-traefik.yaml
176 lines (171 loc) · 3.6 KB
/
00-traefik.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: traefik-ingress-controller
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses
- ingressclasses
verbs:
- get
- list
- watch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses/status
verbs:
- update
- apiGroups:
- traefik.containo.us
resources:
- middlewares
- middlewaretcps
- ingressroutes
- traefikservices
- ingressroutetcps
- ingressrouteudps
- tlsoptions
- tlsstores
- serverstransports
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: traefik-ingress-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: traefik-ingress-controller
subjects:
- kind: ServiceAccount
name: traefik-ingress-controller
namespace: default
---
kind: ConfigMap
apiVersion: v1
metadata:
name: traefik-conf
data:
traefik.toml: |
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http.redirections]
[entryPoints.web.http.redirections.entrypoint]
to = "websecure"
scheme = "https"
priority = 99 # we want to always redirect
[entryPoints.websecure]
address = ":443"
[entryPoints.websecure.http.tls]
[entryPoints.tcp]
address = ":1337"
[providers]
[providers.file]
directory = "/config"
[providers.kubernetesIngress]
[providers.kubernetesCRD]
[api]
insecure = true
dashboard = true
[log]
level = "INFO"
certificates.toml: |
[[tls.certificates]]
certFile = "/config/fullchain.pem"
keyFile = "/config/privkey.pem"
stores = ["default"]
# Ideally, the certs should be as secrets, but I'm also lazy
fullchain.pem: |
HAHA
privkey.pem: |
XD
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: traefik-deployment
labels:
app: traefik
spec:
replicas: 1
selector:
matchLabels:
app: traefik
template:
metadata:
labels:
app: traefik
spec:
serviceAccountName: traefik-ingress-controller
terminationGracePeriodSeconds: 60
containers:
- name: traefik
image: traefik:v2.9
args:
- --configFile=/config/traefik.toml
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
- name: tcp
containerPort: 1337
resources: # not sure if required by GKE?
requests:
memory: 256Mi
cpu: 100m
limits:
memory: 512Mi
cpu: 250m
volumeMounts:
- mountPath: "/config"
name: "config"
volumes:
- name: config
configMap:
name: traefik-conf
---
apiVersion: v1
kind: Service
metadata:
name: traefik-web
spec:
type: LoadBalancer
loadBalancerIP: 35.236.241.54 # gcloud compute addresses describe klodd-ip --region us-east4
ports:
- name: http
targetPort: http
port: 80
- name: https
targetPort: https
port: 443
- name: tcp
targetPort: tcp
port: 1337
selector:
app: traefik