Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You are deploying a legacy HTTP microservice to Google Kubernetes Engine (GKE) behind a Kubernetes ClusterIP Service. You cannot modify the application's source code, and the service exhibits the following startup behavior:
8080, while an internal initialization process takes 45 seconds to load a large in-memory cache.GET /health on port 8080 return an HTTP 200 OK status with a JSON body containing {"ready": false}.GET /health returns 200 OK with {"ready": true}.Which readinessProbe mechanism should you configure in the Pod specification to ensure Kubernetes routes traffic to the Pod only after the cache is loaded?
exec probe that executes a local command inside the container to query http://localhost:8080/health and exit with status 0 only when "ready": true is present in the response body.The exec probe handler configures the kubelet to execute a specified command or script directly inside the running container's namespace. Kubelet evaluates the result based strictly on the command's exit status code: an exit code of 0 indicates success, while any non-zero exit code indicates failure.
200 OK even when unready, a local command (using tools like curl and grep or a small shell script) can fetch http://localhost:8080/health and parse the JSON payload for "ready": true, returning 0 only after the 45-second cache load completes.readinessProbe in a failed state prevents Kubernetes from marking the Pod as Ready or adding it to the ClusterIP Service endpoints until the cache is loaded.localhost keeps the check self-contained within the Pod without depending on external services that could delay or compromise Pod lifecycle operations.periodSeconds, initialDelaySeconds, and failureThreshold to match the 45-second startup window.Unlike httpGet (which accepts any 2xx/3xx status code regardless of body content) and tcpSocket (which only checks if port 8080 is open), exec is the only Kubernetes probe handler capable of evaluating the JSON response body without modifying the application or adding a gRPC health server.
grpc probe targeting port 8080 with the application's service name.The grpc probe handler performs a remote procedure call using the gRPC protocol against the Pod's IP address on a designated port. Specifically, kubelet invokes the grpc.health.v1.Health.Check RPC defined by the standard gRPC Health Checking protocol to determine whether the container is healthy or ready.
The legacy microservice is an HTTP/1 web server that explicitly does not run a gRPC server and cannot have its source code modified. Because the container does not expose a gRPC endpoint or implement the grpc.health.v1.Health service on port 8080, any grpc probe attempt will fail protocol negotiation and return an error. As a result, the Pod would never pass its readinessProbe and would remain permanently unavailable to receive traffic from the ClusterIP Service.
grpc.health.v1.HealthCheckRequest and HealthCheckResponse).service field to check the health of a specific gRPC service registered on the server.grpc_health_probe) inside minimal container images.This option would be the optimal choice if the microservice were built using gRPC, exposed a gRPC listener on its container port, and implemented the grpc.health.v1.Health checking service to report SERVING only after its cache finished loading.
While Kubernetes Pods in GKE support native grpc probes for kubelet health checks, note that GKE Ingress BackendConfig custom health checks only support HTTP, HTTPS, and HTTP/2 protocols rather than gRPC directly.
httpGet probe targeting port 8080 and path /health.The httpGet probe handler instructs the kubelet on the GKE node to perform an HTTP GET request against the Pod's IP address on a specified port and path. It is the most common probe mechanism for web applications and RESTful microservices because it validates that the HTTP server is actively handling requests.
Although the legacy microservice exposes an HTTP /health endpoint on port 8080, the httpGet handler evaluates health strictly by inspecting the HTTP status code, not the response body. Because the application returns 200 OK immediately after startup—even while returning {"ready": false} in the JSON payload—the httpGet probe will immediately pass. As a result, Kubernetes will mark the Pod as Ready and route live traffic to it 45 seconds before the in-memory cache finishes loading, causing errors or degraded performance for users.
200 and less than 400 is treated as a success by kubelet.httpGet probes cannot parse JSON fields or inspect response body strings to determine readiness.httpHeaders (such as a Host header or authorization token), but this does not alter how the response body is evaluated.readinessProbe.httpGet, standard GKE health checks similarly expect a 200 OK status.This option would be the right choice if the application returned a non-2xx/3xx status code (such as 503 Service Unavailable) while the cache was loading, and only switched to 200 OK once initialization completed.
When application code cannot be modified to return an accurate HTTP status code, developers must look beyond httpGet to a mechanism like exec that can inspect the response payload directly.
tcpSocket probe targeting port 8080.The tcpSocket probe handler directs the kubelet to attempt to open a TCP connection (performing a standard TCP handshake) to the Pod's IP address on a specified port. If the port is open and accepts the connection, the diagnostic is marked as successful.
In this scenario, the legacy web server begins listening on port 8080 immediately upon container startup, well before the 45-second cache-loading process completes. Because tcpSocket only verifies Layer 4 network reachability (that a process has bound to and is listening on the port), it cannot inspect HTTP status codes or application-level JSON state. Consequently, the tcpSocket probe will succeed right away, causing Kubernetes to add the Pod to the ClusterIP Service endpoints and send user traffic before the cache is ready.
tcpSocket readiness probes.A tcpSocket probe would be appropriate for a simple TCP server or legacy daemon that does not expose an HTTP or gRPC health endpoint and only opens its listening port once it is completely initialized and ready to handle client connections.
A common misconception is that an open TCP port guarantees application readiness. In cloud-native architectures on GKE, tcpSocket is generally a fallback when richer application-level probes (httpGet, grpc, or exec) are unavailable.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated