在 pod 定义中,我们将 nodeSelector 添加为 spec 的子节点。但我不确定如何在部署 yaml 文件中添加它
我们应该将它添加到模板的规范中吗?
apiVersion: apps/v1
kind: Deployment
metadata:
name: first-deployment
labels:
app: first
spec:
replicas: 1
template:
metadata:
name: first-deployment-pod
label:
app: first
spec:
containers:
- name: test
image: test/test
nodeSelector:
testkey: testvalue
还是我们需要在部署规范中添加它 -
apiVersion: apps/v1
kind: Deployment
metadata:
name: first-deployment
labels:
app: first
spec:
replicas: 1
nodeSelector:
testkey: testvalue
template:
metadata:
name: first-deployment-pod
label:
app: first
spec:
containers:
- name: test
image: test/test