在 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
Run Code Online (Sandbox Code Playgroud)
或者我们是否需要将其添加到部署规范中 -
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
Run Code Online (Sandbox Code Playgroud)