Question

Difficulty: EasyManaging Compute Engine Resources

You are troubleshooting an unresponsive Linux Compute Engine virtual machine instance that is failing to accept SSH connections. You need to view the raw system console boot logs to identify why the startup process halted. Which gcloud command should you run to inspect these logs?

  1. gcloud compute instances get-serial-port-output [INSTANCE_NAME]Answer
  2. B
    gcloud compute instances describe [INSTANCE_NAME]
  3. C
    gcloud compute instances reset [INSTANCE_NAME] --show-logs
  4. D
    gcloud logging read "resource.type=gce_instance" --limit=1

Answer

The command 'gcloud compute instances get-serial-port-output [INSTANCE_NAME]' is the correct choice because it retrieves the serial port output (console log) of a Compute Engine instance, enabling administrators to diagnose boot errors when SSH is inaccessible.
The command 'gcloud compute instances get-serial-port-output [INSTANCE_NAME]' directly reads the serial port output of the specified instance. This is the Google-recommended approach for troubleshooting VM startup failures, kernel panics, or SSH connectivity issues.

Step-by-Step Solution

1
Identify the administrative requirement
The requirement is to inspect low-level system console boot logs for a Compute Engine instance that cannot be reached over the network or via SSH.
When a VM instance experiences boot failures or network misconfigurations, standard SSH access is unavailable.
2
Evaluate gcloud compute command options for console log retrieval
The command dedicated to fetching serial console output is 'gcloud compute instances get-serial-port-output'.
Compute Engine automatically buffers serial port 1 output, which contains kernel and bootloader startup messages.

Key Concept

Inspecting VM Serial Console Output for Diagnostics
Rate this question