Files
go-example/kustomize/deployment.yaml
Zpekii 8aa1fe3ca7
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m16s
feat: add prometheus metrics
2026-03-01 15:08:07 +08: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:000f34a0591306e686e8cf06bf131449eb30b028
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