Kubernetes YAML 入门
# 基本语法
apiVersion: v1 #必选,API 版本号
kind: Deployment #必选,Pod 类型:
metadata: #必选,元数据
name: nginx-deployment #必选,符合 RFC1035 规范的 Pod 名称
namespace: web #可选,不指定默认为 default,Pod 所在命名空间
spec: #必选,用于定义详细信息
selector: #标签选择器
matchLabels:
app: nginx
replicas: 2 #必选,Pod 副本数量
template:
metadata: #必选,元数据
labels: #可选,标签选择器,一般用于 Service Selector
app: nginx
spec: #必选,用于定义详细信息
containers: #必选,定义容器
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
网页编辑 (opens new window)
最近提交: 2023/03/22, 11:52:35