Lesson  in  CKA Mock Exam

Question 11: Pod Ready if Service is Reachable

Configure a readiness probe that depends on a Service having a live endpoint, then make it pass.

Do the following in Namespace default.

Create a Pod named ready-if-service-ready of image nginx:1-alpine.

Configure a LivenessProbe which simply executes command true.

Configure a ReadinessProbe which does check if the url http://service-am-i-ready:80 is reachable, you can use wget -T2 -O- http://service-am-i-ready:80 for this.

Start the Pod and confirm it isn't ready because of the ReadinessProbe.

Then:

Create a second Pod named am-i-ready of image nginx:1-alpine with label id: cross-server-ready.

The already existing Service service-am-i-ready should now have that second Pod as endpoint.

Now the first Pod should be in ready state, check that.

Hint 1

Both probes go under the same container, and both take the same shape: a command that either exits 0 or doesn't. wget's exit code already tells you reachable-or-not — you don't need to inspect its output.

Hint 2

The Service's selector is already fixed (it's existing, you're not meant to touch it) — so whatever gets the first Pod to Ready has to come from matching that selector on the Pod you create second, not from changing the Service.