System Administration
medium

Pregunta de System Administration #019e3a4f

Enunciado de la Pregunta
System Administration
#kubernetes
#garbage-collection
#cluster-management
Medio

Which of the following options include resources cleaned by the Kubernetes garbage collection mechanism?

A

Stale or expired CertificateSigningRequests (CSRs) and old deployments.

B

Nodes deleted by a cloud controller manager and obsolete logs from the kubelet.

C

Unused container and container images, and obsolete logs from the kubelet.

D

Terminated pods, completed jobs, and objects without owner references.

Correcto

Explicación Oficial / Explicaciones de la Comunidad

The Kubernetes garbage collection mechanism is responsible for cleaning up resources that are no longer needed, ensuring cluster health and preventing resource exhaustion. The correct set of resources cleaned includes terminated pods, completed jobs, and objects without owner references.

How it Works

Kubernetes garbage collection runs automatically in the background. It removes:

  • Terminated pods: Pods that have finished execution (e.g., in Succeeded or Failed phase) are cleaned up after a configurable time (default is 5 minutes).
  • Completed jobs: Jobs that have run to completion are removed to free up resources.
  • Objects without owner references: When an owner object (e.g., a ReplicaSet) is deleted, its dependent objects (e.g., pods) are garbage collected if they have an ownerReference pointing to the deleted owner. Objects without any owner references are also subject to cleanup if they are not otherwise needed.

Why the Correct Value is Right

The correct answer lists exactly these three categories: terminated pods, completed jobs, and objects without owner references. This matches the Kubernetes documentation on garbage collection, which states that the garbage collector deletes objects that were owned by a deleted owner (via ownerReferences) and also cleans up completed jobs and terminated pods.

Why the Incorrect Values are Wrong

  • Stale or expired CertificateSigningRequests (CSRs) and old deployments: While CSRs may be cleaned by a separate controller, they are not part of the core garbage collection mechanism. Old deployments are not automatically garbage collected; they remain until explicitly deleted.
  • Nodes deleted by a cloud controller manager and obsolete logs from the kubelet: Node deletion is handled by the cloud controller manager, not the garbage collector. Kubelet logs are managed by log rotation, not garbage collection.
  • Unused container and container images, and obsolete logs from the kubelet: Unused containers and images are cleaned by the kubelet's image garbage collection, which is a separate mechanism. Logs are not part of garbage collection.

Thus, only the set containing terminated pods, completed jobs, and objects without owner references accurately describes resources cleaned by Kubernetes garbage collection.