Question 431 of 500

Quick Answer

The answer is `kubectl logs POD_NAME --previous` because this command retrieves logs from the previous container instance before a crash, allowing you to see the exact output that led to the failure. When a container in a GKE pod crashes and restarts, the current container instance has no record of the events that caused the crash, but the `--previous` flag accesses the terminated container’s logs from the same pod. On the Google Associate Cloud Engineer exam, this question tests your understanding of pod lifecycle and debugging workflows, often appearing as a scenario where you must distinguish between viewing current logs and crash logs. A common trap is choosing `kubectl logs POD_NAME` without the flag, which only shows logs from the running instance and misses the crash evidence. Remember: think of `--previous` as “peeking into the past” — when the container has restarted, you need the previous instance to diagnose why it failed.

Google ACE Practice Question: Ensuring successful operation of a cloud solution

This ACE practice question tests your understanding of ensuring successful operation of a cloud solution. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A GKE pod's container is frequently crashing and restarting. You need to view the logs from the previous container instance (before the last crash) to diagnose the crash cause. Which command retrieves these logs?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "which command"

    Why it matters: Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.

Question 1easymultiple choice
Full question →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

`kubectl logs POD_NAME --previous`

Option B is correct because the `--previous` flag in `kubectl logs` retrieves logs from the previous instance of a container in a pod, which is exactly what you need when the current container has crashed and restarted. This allows you to see the logs that led to the crash, even though the container is now running a new instance.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • `kubectl logs POD_NAME`

    Why it's wrong here

    Without --previous, this shows logs from the current (restarted) container, which may be empty or show post-restart activity only.

  • `kubectl logs POD_NAME --previous`

    Why this is correct

    --previous retrieves logs from the terminated previous container instance — exactly what's needed to see what happened before the crash.

    Clue confirmation

    The clue word "which command" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • `kubectl describe pod POD_NAME`

    Why it's wrong here

    kubectl describe shows events, state transitions, and resource info, but not the full container log output from before the crash.

  • `kubectl get events --field-selector reason=OOMKilled`

    Why it's wrong here

    kubectl get events can show OOMKill events but doesn't provide the container's log output needed for full crash diagnosis.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often confuse `kubectl logs` with `kubectl describe` or `kubectl get events`, thinking those commands provide log output, when in fact only `kubectl logs` retrieves container logs and the `--previous` flag is the specific mechanism to access logs from a crashed instance.

Trap categories for this question

  • Command / output trap

    Without --previous, this shows logs from the current (restarted) container, which may be empty or show post-restart activity only.

Detailed technical explanation

How to think about this question

Under the hood, when a container crashes, Kubernetes restarts it with a new instance, and the previous container's logs are retained in the kubelet's log rotation system (typically under /var/log/pods/). The `--previous` flag instructs the kubelet to read the log file from the terminated container instance. This is particularly useful in crash-loop-backoff scenarios where you need to inspect logs from multiple previous restarts, though `--previous` only shows the immediately preceding instance.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related ACE practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free ACE practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this ACE question test?

Ensuring successful operation of a cloud solution — This question tests Ensuring successful operation of a cloud solution — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: `kubectl logs POD_NAME --previous` — Option B is correct because the `--previous` flag in `kubectl logs` retrieves logs from the previous instance of a container in a pod, which is exactly what you need when the current container has crashed and restarted. This allows you to see the logs that led to the crash, even though the container is now running a new instance.

What should I do if I get this ACE question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "which command". Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More ACE practice questions

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.