Skip to content

Commit 1bd87dc

Browse files
committed
refactor: migrate Kubernetes resources to modern API and security standards
- Update Ingress resource to use networking.k8s.io/v1 API version and new service field syntax - Add securityContext to gorush and redis deployments to enhance container security Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent 41b2021 commit 1bd87dc

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

k8s/gorush-aws-alb-ingress.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: extensions/v1beta1
1+
apiVersion: networking.k8s.io/v1
22
kind: Ingress
33
metadata:
44
name: gorush
@@ -15,6 +15,9 @@ spec:
1515
http:
1616
paths:
1717
- path: /
18+
pathType: Prefix
1819
backend:
19-
serviceName: gorush
20-
servicePort: 8088
20+
service:
21+
name: gorush
22+
port:
23+
number: 8088

k8s/gorush-deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ spec:
2121
imagePullPolicy: Always
2222
ports:
2323
- containerPort: 8088
24+
securityContext:
25+
capabilities:
26+
drop:
27+
- ALL
28+
runAsNonRoot: true
29+
runAsUser: 1000
30+
allowPrivilegeEscalation: false
31+
readOnlyRootFilesystem: false
2432
resources:
2533
requests:
2634
cpu: "250m"

k8s/gorush-redis-deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ spec:
2222
image: redis:7
2323
ports:
2424
- containerPort: 6379
25+
securityContext:
26+
capabilities:
27+
drop:
28+
- ALL
29+
runAsNonRoot: true
30+
runAsUser: 999
31+
allowPrivilegeEscalation: false
32+
readOnlyRootFilesystem: false
2533
resources:
2634
requests:
2735
cpu: "250m"

0 commit comments

Comments
 (0)