Question 30
Domain 2: Workloads & SchedulingIn a Kustomize base/overlay setup, which overlay configuration correctly sets namespace `exercise-14`, scales Deployment `app` to 3 replicas, and adds the common label `env: staging`?
Correct answer: A
Explanation
Kustomize applies overlay settings from `kustomization.yaml`, so setting `namespace: exercise-14` assigns that namespace to generated resources. The `replicas:` field can target Deployment `app` and set it to 3, and `commonLabels: { env: staging }` adds the shared label to all resources in the overlay.
Why each option is right or wrong
A. Use an overlay `kustomization.yaml` with `namespace: exercise-14`, `replicas:` targeting `app` to 3, and `commonLabels: { env: staging }`
Kustomize reads overlay directives from the overlay’s `kustomization.yaml`, and the `namespace` field is the built-in transformer that rewrites all namespaced resources to `exercise-14` during build. The `replicas` transformer can target the Deployment named `app` and set its replica count to exactly `3`, while `commonLabels` injects `env: staging` onto every rendered resource in that overlay.
B. Use a base `kustomization.yaml` with `namespace: exercise-14`, `commonLabels: { env: staging }`, and patch the Service port to 3
C. Create a ConfigMap named `exercise-14`, then use `kubectl scale service app-svc --replicas=3` in the overlay
D. Set `metadata.namespace` and `spec.replicas` only in the Service manifest, because Kustomize automatically applies labels to Deployments