Complete the YAML to add a node selector that schedules the pod on nodes labeled with environment=production.
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mycontainer
image: nginx
nodeSelector:
environment: [1]The nodeSelector key specifies the label key and value to select nodes. Here, environment: production ensures the pod runs on nodes labeled with environment=production.
Complete the YAML to schedule the pod on nodes labeled with disktype=ssd.
apiVersion: v1
kind: Pod
metadata:
name: fastpod
spec:
containers:
- name: fastcontainer
image: busybox
nodeSelector:
disktype: [1]The nodeSelector uses the label disktype: ssd to schedule the pod on nodes with SSD disks.
Fix the error in the nodeSelector to correctly schedule the pod on nodes labeled with region=us-west.
apiVersion: v1
kind: Pod
metadata:
name: regionalpod
spec:
containers:
- name: regionalcontainer
image: alpine
nodeSelector:
region: [1]The nodeSelector must match the exact label value 'us-west' to schedule the pod on nodes in that region.
Fill both blanks to schedule the pod on nodes labeled with tier=backend and environment=production.
apiVersion: v1
kind: Pod
metadata:
name: backendpod
spec:
containers:
- name: backendcontainer
image: redis
nodeSelector:
tier: [1]
environment: [2]The nodeSelector keys 'tier' and 'environment' must match 'backend' and 'production' respectively to schedule the pod on the correct nodes.
Fill all three blanks to schedule the pod on nodes labeled with role=database, zone=us-central1-a, and environment=staging.
apiVersion: v1
kind: Pod
metadata:
name: dbpod
spec:
containers:
- name: dbcontainer
image: postgres
nodeSelector:
role: [1]
zone: [2]
environment: [3]The nodeSelector keys 'role', 'zone', and 'environment' must match 'database', 'us-central1-a', and 'staging' respectively to schedule the pod correctly.