You want to quickly create a YAML template for a deployment named 'nginx' without actually creating the resource in the cluster. Which combination of kubectl flags should you use?

Direct Answer (Verified)Reviewed by Sunny (Senior Cloud Engineer)

Correct Answer: --dry-run=client -o yaml

Combining '--dry-run=client' (which runs the command locally without contacting the API server) and '-o yaml' prints the resource definition in YAML format....

Real Exam ScenarioKubernetes CLI

You want to quickly create a YAML template for a deployment named 'nginx' without actually creating the resource in the cluster. Which combination of kubectl flags should you use?

✓ Correct Answer & ExplanationKubernetes CLI

Correct Answer

--dry-run=client -o yaml

Why This Answer Is Correct

Combining '--dry-run=client' (which runs the command locally without contacting the API server) and '-o yaml' prints the resource definition in YAML format.

📚 What This Question Tests

This question evaluates your knowledge of Kubernetes CLI — a core concept tested in cloud certification exams. Understanding Kubernetes CLI is essential for designing scalable, secure, and cost-effective cloud architectures. Mastery of this topic will help you answer scenario-based questions confidently on exam day.