Bird
0
0

You deployed a microservice with Kubernetes, but it keeps crashing. The YAML file has this snippet:

medium📝 Troubleshoot Q14 of 15
Microservices - Orchestration with Kubernetes
You deployed a microservice with Kubernetes, but it keeps crashing. The YAML file has this snippet:
spec:
  containers:
  - name: app
    image: myapp:v1
    ports:
    - containerPort: 80
  restartPolicy: Never
What is the problem and how to fix it?
AThe pod name is missing; add metadata name
BThe containerPort is wrong; change it to 8080
CThe image version is invalid; update to 'v2'
DThe restartPolicy 'Never' stops restarts; change it to 'Always' to fix
Step-by-Step Solution
Solution:
  1. Step 1: Identify restartPolicy effect

    Setting restartPolicy: Never means Kubernetes will not restart the pod if it crashes.
  2. Step 2: Fix by changing restartPolicy

    Changing restartPolicy to Always lets Kubernetes restart the pod automatically to keep it running.
  3. Final Answer:

    The restartPolicy 'Never' stops restarts; change it to 'Always' to fix -> Option D
  4. Quick Check:

    restartPolicy 'Always' enables auto-restart [OK]
Quick Trick: Use restartPolicy 'Always' to auto-restart pods [OK]
Common Mistakes:
MISTAKES
  • Changing port without checking crash cause
  • Updating image version without error info
  • Ignoring restartPolicy effect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes