-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.yaml
More file actions
40 lines (37 loc) · 819 Bytes
/
deploy.yaml
File metadata and controls
40 lines (37 loc) · 819 Bytes
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
---
kind: Deployment # 组件类型
apiVersion: apps/v1
metadata:
name: hello-api
namespace: netcore # 可指定,不指定时使用默认命名空间
labels:
name: hello-api
spec:
replicas: 2 # 部署两份叫 hello-api 的容器
selector:
matchLabels:
name: hello-api
template:
metadata:
labels:
name: hello-api
spec:
containers:
- name: hello-api
image: siegrainwong/k8s-demo # docker hub 中的镜像名称
ports:
- containerPort: 80
imagePullPolicy: Always
---
kind: Service
apiVersion: v1
metadata:
name: hello-api
namespace: netcore
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
selector:
name: hello-api # 对应要映射的Pod