Skip to content

Commit 4224dfe

Browse files
committed
Expose service to the web
1 parent cec2be9 commit 4224dfe

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

cluster/deployment.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ spec:
88
app: mod-bot
99
serviceName: "mod-bot"
1010
replicas: 1
11+
updateStrategy:
12+
type: RollingUpdate
1113
template:
1214
metadata:
1315
labels:

cluster/ingress.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: mod-bot-ingress
5+
annotations:
6+
nginx.ingress.kubernetes.io/rewrite-target: /
7+
cert-manager.io/cluster-issuer: letsencrypt-prod # Optional, for TLS
8+
spec:
9+
rules:
10+
- host: euno.reactiflux.com
11+
http:
12+
paths:
13+
- path: /
14+
pathType: Prefix
15+
backend:
16+
service:
17+
name: mod-bot
18+
port:
19+
number: 80
20+
tls:
21+
- hosts:
22+
- euno.reactiflux.com
23+
secretName: my-tls-secret # Used for HTTPS

cluster/service.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: mod-bot-service
5+
labels:
6+
app: mod-bot
7+
spec:
8+
type: ClusterIP
9+
ports:
10+
- port: 80 # External port
11+
targetPort: 3000 # Port the pod exposes
12+
selector:
13+
app: mod-bot

kustomization.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ namespace: default
44
commonLabels:
55
app: mod-bot
66
resources:
7+
- cluster/service.yaml
78
- cluster/deployment.yaml
9+
- cluster/ingress.yaml
810

911
configMapGenerator:
1012
- name: k8s-context # this is an internal name

0 commit comments

Comments
 (0)