Skaffold Multiple Profiles for GKE Replica Counts

PCDOE By islever Editorial Last updated

Designing pipelines.

Short answer

C Create multiple profiles, and configure the manifests.rawYaml section to override replica counts for each environment.

Question

You are configuring a Cloud Deploy pipeline to deploy an application to Google Kubernetes Engine (GKE). The application is deployed as a Deployment. You need to configure the Deployment so that there are two replicas in the development environment and five replicas in the production environment. You must ensure that all other configuration parameters are consistent between environments. You also need to minimize developmental overhead when updating the manifests in the future. How should you configure the skaffold.yaml file?
  1. Create multiple profiles, and configure the manifests.kustomize section.
  2. Create a single profile, and configure the manifests.kustomize section.
  3. Create multiple profiles, and configure the manifests.rawYaml section. Correct Answer
  4. Create a single profile, and configure the manifests.rawYaml section.

Key Takeaways

The core concept tested is Skaffold's profile mechanism for overriding specific fields like replicas, with the common trap being the choice between Kustomize (which modifies structure) versus Raw YAML (which overrides values directly).

This question examines how to configure Skaffold profiles in skaffold.yaml to manage environment-specific Kubernetes replica counts while maintaining manifest consistency. It establishes that using multiple profiles with raw YAML is the optimal approach for minimizing overhead and ensuring configuration parity.

Common mistake: Many learners incorrectly select Option A, assuming Kustomize is required for any environment differentiation. However, Kustomize introduces structural changes and patching logic which adds complexity and potential drift compared to simple value overrides needed here.

Expert Analysis

Why the Answer Is Correct

Option C is correct because Skaffold allows you to define multiple profiles within a single skaffold.yaml file. Each profile can override specific values in the deployment manifests. By using manifests.rawYaml, you can specify exact field overrides (like replicas) for each environment without altering the underlying YAML structure or requiring external tools like Kustomize. This ensures all other parameters remain consistent and minimizes maintenance overhead.

Why the Other Options Are Wrong

Option A suggests using Kustomize, which involves creating patches and modifying the resource structure. While powerful, it is overkill for simple scalar overrides like replica counts and increases complexity. Options B and D suggest using a single profile, which cannot handle different configurations for development and production environments simultaneously within the same pipeline run context as effectively as distinct profiles.

Community Comment Notes

Community feedback highlights the preference for "multiple profiles" to separate dev and prod concerns. One commenter noted that kustomize is often chosen for its ability to change replica counts, but this overlooks the simplicity of raw YAML overrides for such specific, isolated changes.

Exam Strategy

When configuring Skaffold, prioritize profiles for environment separation. Use rawYaml for direct value overrides (like replicas) to keep manifests simple and maintainable, reserving kustomize for more complex structural modifications.

Frequently Asked Questions

Why not use Kustomize for replica counts?

Kustomize requires defining patches and managing additional files. For simple scalar overrides like replicas, raw YAML is more direct and reduces configuration overhead.

Can I use a single profile for both envs?

No, a single profile applies one set of configurations. Multiple profiles allow distinct settings (e.g., 2 vs 5 replicas) to be activated per environment.

More PCDOE FAQ →

Discussion 1 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 1

  1. BlackCoffee 👍 1 Answered A
    multiple profiles for dev and prod, manifests.kustomize to change the replicas count for development and production

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Practice All PCDOE Questions

Access 75 questions with complete answers and detailed explanations.

View Full PCDOE Practice Test →

← Back to PCDOE Study Guide