You must deploy an API to AKS with three replicas and a stable internal address, and keep the definition in source control. Which approach fits?
- Exam domain
- Develop containerized solutions on Azure20–25% of the exam
- Difficulty
- Medium
- In this mock
- 14 questions on this domainPractise this domain
Why the exam asks this
Develop containerized solutions on Azure: Implement container-orchestrated solutions.
Objective in the exam guide: Deploy and manage applications to Azure Kubernetes Service (AKS) by using manifest files.
Manifests are how real teams manage Kubernetes. The exam checks the core objects and the apply workflow.
Why C is the answer
Write a manifest with a Deployment (replicas: 3) and a Service, and apply it with kubectl apply -f
A Deployment keeps the desired number of replicas running, a Service gives them a stable address, and kubectl apply makes the cluster match the manifest.
Remember: Desired state in YAML: Deployment for replicas, Service for the address.
How it works
A Deployment declares the pod template and how many replicas should run; Kubernetes replaces pods that fail.
A Service gives the pods a stable name and address and load-balances across them.
kubectl apply -f api.yaml creates or updates the objects to match the file.
Clues in the question
The words that point to the answer, and what each one tells you.
- Three replicas
- Deployment.
- Stable internal address
- Service.
- In source control
- Manifest files.
In detail
- kubectl apply is declarative: re-applying an edited manifest updates the running objects.
- Use kubectl get pods and kubectl get service to confirm the result.
Side by side with look-alikes
| Object | Provides |
|---|---|
| Deployment | Replicas, rolling updates, self-healing |
| Service | Stable address and load balancing |
| ConfigMap | Non-secret configuration |
| Secret | Sensitive configuration |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Store the image in a ConfigMapWrong
ConfigMaps hold configuration, not images.
B. Create three separate pods with docker run on the nodesWrong
Running containers directly on nodes bypasses Kubernetes.
C. Write a manifest with a Deployment (replicas: 3) and a Service, and apply it with kubectl apply -fRight
Desired state in YAML: Deployment for replicas, Service for the address.
D. Run kubectl run three times by handWrongMost tempting
Manual commands are not repeatable or reviewable.
Why it tempts: It does start pods quickly. But nothing records or maintains the desired state.
In practice
- Set resource requests and limits in the pod template.
Use case
An illustrative scenario, not a real incident.
A team keeps api.yaml in Git; changing replicas to 5 and re-applying scales the API.
See how it works
flowchart LR Y["api.yaml in Git"] --> K["kubectl apply -f api.yaml"] K --> D["Deployment: replicas 3"] K --> S["Service: api"] D --> P1["Pod 1"] D --> P2["Pod 2"] D --> P3["Pod 3"] S --> P1 S --> P2 S --> P3
How to read this chart
- "api.yaml in Git" leads to "kubectl apply -f api.yaml".
- "kubectl apply -f api.yaml" leads to "Deployment: replicas 3" and "Service: api".
- "Deployment: replicas 3" leads to "Pod 1" and "Pod 2" and "Pod 3".
- "Service: api" leads to "Pod 1" and "Pod 2" and "Pod 3".