-
Notifications
You must be signed in to change notification settings - Fork 3
/
deployment.yaml
53 lines (50 loc) · 1.23 KB
/
deployment.yaml
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
50
51
52
# 库本linux
apiVersion: apps/v1
kind: Deployment
metadata:
name: zptestapp
spec:
replicas: 1
selector:
matchLabels:
app: zptestapp
# 定义了pod相关的所有信息
template:
metadata:
labels:
app: zptestapp
spec:
# 指定了pod中运行的所有容器
containers:
- name: zptestapp
image: registry.cn-beijing.aliyuncs.com/electrolux_docker_respository/zptest_ks
resources:
# 设置cpu和内存配额
limits:
memory: "512Mi"
cpu: "1000m"
# 容器需要对外暴露的端口
ports:
- containerPort: 80
# 如果要从外网访问应用 ,我们需要用 nodeport 的 方式
# k8s采用 loadBalancer Ingress实现负载均衡registry.cn-beijing.aliyuncs.com/electrolux_docker_respository/zptest_ks
# imagePullSecrets:
# - name: regcred
# dnsPolicy: ClusterFirst
# restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
# 转发的pod名字
selector:
app: zptestapp
ports:
- port: 80
targetPort: 80
# 可以省略这一行让k8s自动分配
nodePort: 30010
---