【发布时间】:2019-03-02 10:09:00
【问题描述】:
第一个也是最小的example of a Deployment in the Kubernetes documentation 具有重复三次的app: nginx 行。我知道这是一个标签,但我没有找到任何解释为什么需要为所有这些指定的:
-
metadata.labels, -
spec.selector.matchLabels,和 spec.template.metadata.labels
示例部署文件:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
【问题讨论】:
标签: kubernetes