Start your terminal to use beginner mode.
Scenario
You are deploying a distributed database named dns-app in the dev namespace. This application requires that each Pod be addressable by a predictable, unchanging hostname (e.g., dns-app-0.dns-app) so the nodes can find each other for data replication. Standard Services (which load balance) are not suitable for this.
Task
Create a Headless Service named dns-app in the dev namespace. Create a StatefulSet named dns-app with 3 replicas image nginx:alpine. Ensure the StatefulSet uses the dns-app service for network identity. Verify that pods have stable DNS names like dns-app-0.dns-app
Use kubectl exec -it netshoot -n dev -- nslookup dns-app-0.dns-app to validate resolution.
Example
Failing Check (Standard Service):
$ kubectl get svc dns-app -n dev
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
dns-app ClusterIP 10.43.20.155 <none> 80/TCP
Success Check (Headless Service):
$ kubectl get svc dns-app -n dev
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
dns-app ClusterIP None <none> 80/TCP
Terminal requires a larger screen
Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.
Kubernetes Environment
Launch a live cluster to solve this challenge.
Track
| Question | Difficulty | Company | Access |
|---|
Okta