65 lines
1.7 KiB
YAML
65 lines
1.7 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: myblog
|
|
namespace: test
|
|
spec:
|
|
replicas: 2 # 指定Pod副本数
|
|
selector: # 指定Pod的选择器
|
|
matchLabels:
|
|
app: myblog
|
|
template:
|
|
metadata:
|
|
labels: # 给Pod打label
|
|
app: myblog
|
|
spec:
|
|
containers:
|
|
- name: myblog
|
|
image: harbor.opsbase.cn/public/myblog
|
|
imagePullPolicy: IfNotPresent
|
|
env:
|
|
- name: MYSQL_HOST
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: test-db-configmap
|
|
key: Mysql_Host
|
|
- name: MYSQL_PORT
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: test-db-configmap
|
|
key: Mysql_PORT
|
|
- name: MYSQL_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: test-db-secret
|
|
key: MYSQL_USER
|
|
- name: MYSQL_PASSWD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: test-db-secret
|
|
key: MYSQL_PASSWD
|
|
ports:
|
|
- containerPort: 80
|
|
resources:
|
|
requests:
|
|
memory: 100Mi
|
|
cpu: 50m
|
|
limits:
|
|
memory: 500Mi
|
|
cpu: 100m
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /blog/index/
|
|
port: 80
|
|
scheme: HTTP
|
|
initialDelaySeconds: 10 # 容器启动后第一次执行探测是需要等待多少秒
|
|
periodSeconds: 15 # 执行探测的频率
|
|
timeoutSeconds: 2 # 探测超时时间
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /blog/index/
|
|
port: 80
|
|
scheme: HTTP
|
|
initialDelaySeconds: 10
|
|
timeoutSeconds: 2
|
|
periodSeconds: 15 |