Complete the code to specify the kind of Kubernetes object for a Deployment.
apiVersion: apps/v1
kind: [1]
metadata:
name: nginx-deploymentThe kind field specifies the type of Kubernetes object. For managing replicas and updates, Deployment is used.
Complete the code to set the number of pod replicas in a Deployment.
spec:
replicas: [1]The replicas field expects a number, not a string or boolean. Here, 3 means three pod copies.
Fix the error in the selector field to correctly match pod labels.
spec:
selector:
matchLabels:
app: [1]The selector must match the label value of pods. Here, pods have label app: nginx, so the value should be nginx.
Fill both blanks to complete the pod template labels and container image.
spec:
template:
metadata:
labels:
app: [1]
spec:
containers:
- name: nginx
image: [2]The pod labels must match the selector value, so app: nginx. The container image should specify a valid image tag like nginx:1.21.
Fill all three blanks to complete the Deployment spec with replicas, selector, and container image.
apiVersion: apps/v1 kind: Deployment metadata: name: webapp spec: replicas: [1] selector: matchLabels: app: [2] template: metadata: labels: app: [2] spec: containers: - name: webapp image: [3]
The Deployment runs 3 replicas (3), with pods labeled app: webapp. The container image is webapp:v2 for version control.