一个小栗子
apiVersion: apps/v1
kind: Deployment
metadata:
name: ebdp-interface-service
namespace: ebdp-bigdata
spec:
replicas: 2
minReadySeconds: 40
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
app: ebdp-interface-service
template:
metadata:
labels:
app: ebdp-interface-service
date: createdate
spec:
nodeSelector:
nodetype: ebdp
hostAliases:
- ip: "192.168.6.120"
hostnames:
- "www.baidu.com"
containers:
- name: ebdp-interface-service
image: souhu.com/ebdp-bigdata-prod/ebdp-interface-service:1.2.7.1
imagePullPolicy: Always
resources:
requests:
cpu: 4000m
memory: 4Gi
limits:
cpu: 16000m
memory: 8Gi
ports:
- name: ebdp-interface
containerPort: 8080
# 就绪检测
readinessProbe:
failureThreshold: 3
tcpSocket:
port: 8080
initialDelaySeconds: 30
periodSeconds: 30
# 优雅退出
lifecycle:
preStop:
exec:
command:
- sleep
- 30
volumeMounts:
- name: ebdp-interface-service-log
mountPath: /logs/
terminationGracePeriodSeconds : 60
volumes:
- name: ebdp-interface-service-log
hostPath:
path: /opt/ebdp-interface-service/
现在学习还不晚;