Bitzu

KCNA ยท Kubernetes core concepts

Labels, selectors, annotations and namespaces

Organizing and selecting objects, namespace scoping, resource quotas at a conceptual level.

Key points

  • Labels are key/value pairs for identifying objects; selectors pick objects by label (how a Service finds Pods or a ReplicaSet finds its own).
  • Annotations hold non-identifying metadata and are not used for selection.
  • Namespaces split a cluster into scopes: names are unique within one, and ResourceQuotas cap what a namespace can consume.

Source: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/

Practice questions

Single choice

Which metadata is meant for identifying and selecting objects?

  1. Annotations
  2. Labels
  3. Finalizers
  4. Status
Show answer

Answer: B. Labels

Labels are the selectable identifying key/value pairs. Annotations carry extra non-identifying information.

Select all that apply

Which statements about namespaces are correct?

  1. Resource names must be unique within a namespace
  2. ResourceQuotas can limit consumption per namespace
  3. Nodes are not namespaced objects
  4. Namespaces can be nested inside each other
  5. Every cluster-wide object lives in default
Show answer

Answer: A. Resource names must be unique within a namespace, B. ResourceQuotas can limit consumption per namespace, C. Nodes are not namespaced objects

Names are scoped per namespace, quotas apply per namespace and cluster-level objects like Nodes belong to none. Nesting is not supported.

True or false

Namespaces can be nested inside each other to build a hierarchy.

Show answer

Answer: False

Namespaces are flat; each namespaced object belongs to exactly one namespace.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More KCNA topics in this module