feat: add configuration management and update deployment files

This commit is contained in:
2026-01-10 19:56:51 +08:00
parent 6730ceafa6
commit d1a5240c34
10 changed files with 180 additions and 21 deletions

View File

@@ -2,18 +2,20 @@ apiVersion: v1
kind: Service
metadata:
name: k8s-example
namespace: helloapp
spec:
selector:
app: k8s-example
ports:
- port: 8800
targetPort: 8800
- port: 8800
targetPort: 8800
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: k8s-example
namespace: helloapp
spec:
selector:
matchLabels:
@@ -25,15 +27,45 @@ spec:
app: k8s-example
spec:
containers:
- name: k8s-example
image: localhost:8180/k8s-example/k8s-example:latest
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "128Mi"
cpu: "500m"
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 8800
- name: k8s-example
image: localhost:8180/k8s-example/k8s-example:latest
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "128Mi"
cpu: "500m"
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 8800
volumeMounts:
- name: config-volume
mountPath: /config
- name: helloapp-test-key
mountPath: /certs
command: ["/helloapp"]
args: ["-f", "/config/.linux-config.json"]
volumes:
- name: config-volume
configMap:
name: k8s-example-config
- name: helloapp-test-key
secret:
secretName: helloapp-test-key
---
apiVersion: v1
kind: ConfigMap
metadata:
name: k8s-example-config
namespace: helloapp
data:
.linux-config.json: |
{
"server": {
"port": 8800
},
"certs": {
"testKeyPath": "./certs/test.key"
}
}