Skip to Content
Kubernetes: Up and Running, 3rd Edition
book

Kubernetes: Up and Running, 3rd Edition

by Brendan Burns, Joe Beda, Kelsey Hightower, Lachlan Evenson
August 2022
Intermediate to advanced
328 pages
8h 22m
English
O'Reilly Media, Inc.
Book available
Content preview from Kubernetes: Up and Running, 3rd Edition

Chapter 6. Labels and Annotations

Kubernetes was made to grow with you as your application scales in both size and complexity. Labels and annotations are fundamental concepts in Kubernetes that let you work in sets of things that map to how you think about your application. You can organize, mark, and cross-index all of your resources to represent the groups that make the most sense for your application.

Labels are key/value pairs that can be attached to Kubernetes objects such as Pods and ReplicaSets. They can be arbitrary and are useful for attaching identifying information to Kubernetes objects. Labels provide the foundation for grouping objects.

Annotations, on the other hand, provide a storage mechanism that resembles labels: key/value pairs designed to hold nonidentifying information that tools and libraries can leverage. Unlike labels, annotations are not meant for querying, filtering, or otherwise differentiating Pods from each other.

Labels

Labels provide identifying metadata for objects. These are fundamental qualities of the object that will be used for grouping, viewing, and operating. The motivations for labels grew out of Google’s experience in running large and complex applications. A couple of lessons emerged from this experience:

  • Production abhors a singleton. When deploying software, users often start with a single instance. However, as the application matures, these singletons often multiply and become sets of objects. With this in mind, Kubernetes uses labels ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Terraform: Up and Running, 3rd Edition

Terraform: Up and Running, 3rd Edition

Yevgeniy Brikman
Docker: Up & Running, 3rd Edition

Docker: Up & Running, 3rd Edition

Sean P. Kane, Karl Matthias
Ansible: Up and Running, 3rd Edition

Ansible: Up and Running, 3rd Edition

Bas Meijer, Lorin Hochstein, René Moser

Publisher Resources

ISBN: 9781098110192Errata PageSupplemental Content