Files
go-example/kustomize/deployment.yaml
2026-03-01 08:17:47 +00:00

77 lines
1.7 KiB
YAML

apiVersion: v1
kind: Namespace
metadata:
name: helloapp
---
apiVersion: v1
kind: Service
metadata:
name: go-example
namespace: helloapp
spec:
selector:
app: go-example
ports:
- port: 8800
targetPort: 8800
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: go-example
namespace: helloapp
spec:
selector:
matchLabels:
app: go-example
replicas: 3
template:
metadata:
labels:
app: go-example
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8800"
prometheus.io/path: "/metrics"
spec:
containers:
- name: go-example
image: harbor.0orz.top/go-example/go-example:8aa1fe3ca728a78b60169f0a2c61c75ffd2901bb
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "5Mi"
cpu: "10m"
limits:
memory: "50Mi"
cpu: "100m"
ports:
- containerPort: 8800
volumeMounts:
- name: config-volume
mountPath: /config
- name: helloapp-test-key
mountPath: /certs
command: ["/helloapp"]
args: ["-f", "/config/.linux-config.yaml"]
volumes:
- name: config-volume
configMap:
name: go-example-config
- name: helloapp-test-key
secret:
secretName: helloapp-test-key # 需要事先创建该 Secret
---
apiVersion: v1
kind: ConfigMap
metadata:
name: go-example-config
namespace: helloapp
data:
.linux-config.yaml: |
server:
port: 8800
certs:
testKeyPath: /certs/test.key