Files
go-example/deployment.yaml
2026-01-25 09:58:43 +00:00

73 lines
1.5 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
spec:
containers:
- name: go-example
image: harbor.0orz.top/go-example/go-example:76a838ef4f5db9810dbd0b72712b823e69e1ef54
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