-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathk8s-deploy.yaml
More file actions
49 lines (47 loc) · 1.41 KB
/
k8s-deploy.yaml
File metadata and controls
49 lines (47 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
apiVersion: apps/v1
kind: Deployment
metadata:
name: reservation-client
labels:
app: reservation-client
spec:
replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
app: reservation-client
minReadySeconds: 0
strategy:
type: RollingUpdate # 策略类型,使用RollingUpdate可以保证部署期间服务不间断
rollingUpdate:
maxUnavailable: 1 # 部署时最大允许停止的Pod数量(与replicas相比)
maxSurge: 1 # 部署时最大允许创建的Pod数量(与replicas相比)
template: # 用来指定Pod的模板,与Pod的定义类似
metadata:
labels: # 根据模板创建的Pod会被贴上该标签,与上面的matchLabels对应
app: reservation-client
spec:
containers:
- name: reservation-client
image: openreservation/angular-client:latest
imagePullPolicy: IfNotPresent # 默认是IfNotPresent,如果设置成Always,则每一次部署都会重新拉取容器映像(否则,如果本地存在指定的镜像版本,就不会再去拉取)
resources:
limits:
memory: "64Mi"
cpu: "50m"
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: reservation-client
spec:
selector:
app: reservation-client
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 31221
type: NodePort