Skip to content

Commit bfebd40

Browse files
updates and ingress controllers
1 parent 969c355 commit bfebd40

File tree

7 files changed

+330
-1
lines changed

7 files changed

+330
-1
lines changed

kubernetes/deployments/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
spec:
2323
containers:
2424
- name: example-app
25-
image: aimvector/golang:1.0.0
25+
image: aimvector/python:1.0.0
2626
imagePullPolicy: Always
2727
ports:
2828
- containerPort: 5000
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
kind: ConfigMap
2+
apiVersion: v1
3+
metadata:
4+
name: traefik-config
5+
namespace: kube-system
6+
data:
7+
config.toml: |-
8+
[metrics]
9+
[metrics.prometheus]
10+
entryPoint = "traefik"
11+
buckets = [0.1,0.3,1.2,5.0]
12+
[entryPoints]
13+
[entryPoints.http]
14+
address = ":80"
15+
[entryPoints.http.redirect]
16+
entryPoint = "https"
17+
[entryPoints.https]
18+
address = ":443"
19+
[entryPoints.https.tls]
20+
[acme]
21+
22+
storage = "acme.json"
23+
entryPoint = "https"
24+
onHostRule = true
25+
[[acme.domains]]
26+
main = "local1.com"
27+
[acme.httpChallenge]
28+
entryPoint = "http"
29+
################################################################
30+
# Global configuration
31+
################################################################
32+
33+
# Enable debug mode
34+
#
35+
# Optional
36+
# Default: false
37+
#
38+
# debug = true
39+
40+
# Log level
41+
#
42+
# Optional
43+
# Default: "ERROR"
44+
#
45+
# logLevel = "DEBUG"
46+
47+
################################################################
48+
# Entrypoints configuration
49+
################################################################
50+
51+
# Entrypoints definition
52+
#
53+
# Optional
54+
# Default:
55+
#[entrypoints]
56+
# [entrypoints.web]
57+
# address = ":80"
58+
59+
################################################################
60+
# Traefik logs configuration
61+
################################################################
62+
63+
# Traefik logs
64+
# Enabled by default and log to stdout
65+
#
66+
# Optional
67+
#
68+
# [traefikLog]
69+
70+
# Sets the filepath for the traefik log. If not specified, stdout will be used.
71+
# Intermediate directories are created if necessary.
72+
#
73+
# Optional
74+
# Default: os.Stdout
75+
#
76+
# filePath = "log/traefik.log"
77+
78+
# Format is either "json" or "common".
79+
#
80+
# Optional
81+
# Default: "common"
82+
#
83+
# format = "common"
84+
85+
################################################################
86+
# Access logs configuration
87+
################################################################
88+
89+
# Enable access logs
90+
# By default it will write to stdout and produce logs in the textual
91+
# Common Log Format (CLF), extended with additional fields.
92+
#
93+
# Optional
94+
#
95+
# [accessLog]
96+
97+
# Sets the file path for the access log. If not specified, stdout will be used.
98+
# Intermediate directories are created if necessary.
99+
#
100+
# Optional
101+
# Default: os.Stdout
102+
#
103+
# filePath = "/path/to/log/log.txt"
104+
105+
# Format is either "json" or "common".
106+
#
107+
# Optional
108+
# Default: "common"
109+
#
110+
# format = "common"
111+
112+
################################################################
113+
# API and dashboard configuration
114+
################################################################
115+
116+
# Enable API and dashboard
117+
#[api]
118+
119+
# Name of the related entry point
120+
#
121+
# Optional
122+
# Default: "traefik"
123+
#
124+
# entryPoint = "traefik"
125+
126+
# Enabled Dashboard
127+
#
128+
# Optional
129+
# Default: true
130+
#
131+
# dashboard = false
132+
133+
################################################################
134+
# Ping configuration
135+
################################################################
136+
137+
# Enable ping
138+
#[ping]
139+
140+
# Name of the related entry point
141+
#
142+
# Optional
143+
# Default: "traefik"
144+
#
145+
# entryPoint = "traefik"
146+
147+
################################################################
148+
# Docker configuration backend
149+
################################################################
150+
151+
# Enable Docker configuration backend
152+
#[docker]
153+
154+
# Docker server endpoint. Can be a tcp or a unix socket endpoint.
155+
#
156+
# Required
157+
# Default: "unix:///var/run/docker.sock"
158+
#
159+
# endpoint = "tcp://10.10.10.10:2375"
160+
161+
# Default domain used.
162+
# Can be overridden by setting the "traefik.domain" label on a container.
163+
#
164+
# Optional
165+
# Default: ""
166+
#
167+
# domain = "docker.localhost"
168+
169+
# Expose containers by default in traefik
170+
#
171+
# Optional
172+
# Default: true
173+
#
174+
# exposedByDefault = true
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: traefik-ingress-controller
6+
namespace: kube-system
7+
---
8+
kind: Deployment
9+
apiVersion: extensions/v1beta1
10+
metadata:
11+
name: traefik-ingress-controller
12+
namespace: kube-system
13+
labels:
14+
k8s-app: traefik-ingress-lb
15+
spec:
16+
replicas: 1
17+
selector:
18+
matchLabels:
19+
k8s-app: traefik-ingress-lb
20+
template:
21+
metadata:
22+
labels:
23+
k8s-app: traefik-ingress-lb
24+
name: traefik-ingress-lb
25+
spec:
26+
serviceAccountName: traefik-ingress-controller
27+
terminationGracePeriodSeconds: 60
28+
containers:
29+
- image: traefik:v1.7.18-alpine
30+
name: traefik-ingress-lb
31+
ports:
32+
- name: http
33+
containerPort: 80
34+
- name: https
35+
containerPort: 443
36+
- name: admin
37+
containerPort: 8080
38+
args:
39+
- --api
40+
- --kubernetes
41+
- --logLevel=INFO
42+
- --configFile=/etc/traefik/config.toml
43+
volumeMounts:
44+
- name: traefik-config
45+
mountPath: /etc/traefik/
46+
volumes:
47+
- name: traefik-config
48+
configMap:
49+
name: traefik-config
50+
---
51+
kind: Service
52+
apiVersion: v1
53+
metadata:
54+
name: traefik-ingress-service
55+
namespace: kube-system
56+
spec:
57+
selector:
58+
k8s-app: traefik-ingress-lb
59+
type: LoadBalancer
60+
ports:
61+
- protocol: TCP
62+
port: 80
63+
name: web
64+
- protocol: TCP
65+
port: 443
66+
name: https
67+
- protocol: TCP
68+
port: 8080
69+
name: admin
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
kind: ClusterRole
3+
apiVersion: rbac.authorization.k8s.io/v1beta1
4+
metadata:
5+
name: traefik-ingress-controller
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- services
11+
- endpoints
12+
- secrets
13+
verbs:
14+
- get
15+
- list
16+
- watch
17+
- apiGroups:
18+
- extensions
19+
resources:
20+
- ingresses
21+
verbs:
22+
- get
23+
- list
24+
- watch
25+
- apiGroups:
26+
- extensions
27+
resources:
28+
- ingresses/status
29+
verbs:
30+
- update
31+
---
32+
kind: ClusterRoleBinding
33+
apiVersion: rbac.authorization.k8s.io/v1beta1
34+
metadata:
35+
name: traefik-ingress-controller
36+
roleRef:
37+
apiGroup: rbac.authorization.k8s.io
38+
kind: ClusterRole
39+
name: traefik-ingress-controller
40+
subjects:
41+
- kind: ServiceAccount
42+
name: traefik-ingress-controller
43+
namespace: kube-system
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: traefik-web-ui
6+
namespace: kube-system
7+
spec:
8+
selector:
9+
k8s-app: traefik-ingress-lb
10+
ports:
11+
- name: web
12+
port: 80
13+
targetPort: 8080
14+
---

kubernetes/ingress/ingress.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Ingress
3+
metadata:
4+
name: example-service
5+
annotations:
6+
kubernetes.io/ingress.class: "traefik"
7+
traefik.ingress.kubernetes.io/frontend-entry-points: http,https
8+
#traefik.ingress.kubernetes.io/redirect-entry-point: https
9+
#traefik.ingress.kubernetes.io/redirect-permanent: "true"
10+
spec:
11+
rules:
12+
- host: marcel.test
13+
http:
14+
paths:
15+
- path: /
16+
backend:
17+
serviceName: example-service
18+
servicePort: 80

kubernetes/services/service.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: example-service
5+
spec:
6+
selector:
7+
app: example-app
8+
ports:
9+
- protocol: TCP
10+
port: 80
11+
targetPort: 5000

0 commit comments

Comments
 (0)