• Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

Get Deployment annotation from a Kubernetes Pod

Each Kubernetes deployment gets this annotation:

Is there a way to read that annotation ( deployment.kubernetes.io/revision ) from a pod that belongs to the deployment?

I tried Downward API, but that only allows to get annotations of the pod itself (not of its deployment).

Kir's user avatar

7 Answers 7

StanislavKo's user avatar

  • 1 Please provide some explanation along with the code. –  M-- Commented Nov 11, 2019 at 18:43
  • 1 @M-- what this command does is it extracts the annotations from the metadata section of the resource definition. jsonpath type output can be used to navigate the resource definition. –  Nandun Bandara Commented Dec 29, 2022 at 2:50
  • @NandunThilinaBandara I am asking for an explanation to increase the quality of the answer, not that I had a question about it. In any case, thanks. –  M-- Commented Dec 29, 2022 at 4:07
  • @M - Hello, i've not worked with k8s for last 2 years. So i would leave the answer as is, because it seems it helps some people. Thank you! –  StanislavKo Commented Dec 30, 2022 at 17:38

It has been a long time but here is what I do to get a specific annotation :

So for you it would be :

I hope it helps.

KrustyHack's user avatar

As an alternative, you can leverage both using a kubectl selector to query all pods with label app=myapp and jq to query and format the resulting json to get you the name and annotations for each of the pods

iamnicoj's user avatar

Yes you can get the annotation from a pod using below command:

and you will find Annotations section with all annotation for pod.

Nick Rak's user avatar

Yes. Its possible by the below command-

kubectl get pod myapp -n=default -o yaml | grep -A 8 annotations:

kubectl get pod myapp -n=default -o yaml gets all the details of the pod myapp in default namespace in yaml format.

grep -A 8 metadata: searches for keyword 'annotations' and displays 8 lines as specified by A 8 to show all the annotations

Swetha R Naik's user avatar

Command to list annotations for all pods

kubectl annotate pod --list --all

Command to get annotation for only one specific pod

kubectl annotate pod my-pod --list

Command to get annotation for one or more specific pod

kubectl annotate pod my-pod1 my-pod2 --list

Varsha Aaynure's user avatar

  • thank you. how do i get just one particular annotation to be lsited? –  Surya Commented Apr 16 at 11:05

to get only the annotations section of the pod you can use

you can also use jsonPath like

jihed zaoueli's user avatar

  • you cant specify output in describe command, only in get –  potatopotato Commented Aug 31, 2020 at 13:28

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged kubernetes or ask your own question .

  • The Overflow Blog
  • How to build open source apps in a highly regulated industry
  • Community Products Roadmap Update, July 2024
  • Featured on Meta
  • We spent a sprint addressing your requests — here’s how it went
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network...
  • Policy: Generative AI (e.g., ChatGPT) is banned
  • The [lib] tag is being burninated
  • What makes a homepage useful for logged-in users

Hot Network Questions

  • exploded pie chart, circumscribing arc, and text labels
  • Airtight beaks?
  • Is there a way to do artificial gravity testing of spacecraft on the ground in KSP?
  • Minimum number of players for 9 round Swiss tournament?
  • Factor-smooth interactions in generalized additive models
  • Is it "ok" to use different compression ratios in different bands, on a multiband compressor?
  • Is there a generalization of factoring that can be extended to the Real numbers?
  • Do we use "the + singular noun" to express that type of goods?
  • Word split between two lines is not found in man pages search
  • Books using the axiomatic method
  • Evil God Challenge: What if an evil god is just trolling humanity and that explains why there's good in the world?
  • Are there examples of triple entendres in English?
  • What does a letter "R" means in a helipad?
  • Line from Song KÄMPFERHERZ
  • Why does the Trump immunity decision further delay the trial?
  • Is it possible to arrange the free n-minoes of orders 2, 3, 4 and 5 into a rectangle?
  • How to avoid division by zero with a binary variable at the denominator in a network assignment problem?
  • PCB layout for 16 MHz crystal oscillator
  • Should "as a ..." and "unlike ..." clauses refer to the subject?
  • Did the BBC censor a non-binary character in Transformers: EarthSpark?
  • Staying in USA longer than 3 months
  • Book that I read around 1975, where the main character is a retired space pilot hired to steal an object from a lab called Menlo Park
  • Who originated the idea that the primary purpose of government is to protect its citizens?
  • Don't make noise. OR Don't make a noise

kubectl get resource with annotation

 alt=

Kubernetes: query by annotation with kubectl

kubectl get resource with annotation

You can, however, use the power of jsonpath to find these objects.  Below is an example of finding all Services that have the ‘prometheus.io/scrape’ annotation, which is a common annotation used for monitoring.

If you wanted to pull multiple values for the object, you can use range on each object found.

sachin on stackoverflow, filter on annotation

google, kubectl cheatsheet

Annotations

You can use Kubernetes annotations to attach arbitrary non-identifying metadata to objects . Clients such as tools and libraries can retrieve this metadata.

Attaching metadata to objects

You can use either labels or annotations to attach metadata to Kubernetes objects. Labels can be used to select objects and to find collections of objects that satisfy certain conditions. In contrast, annotations are not used to identify and select objects. The metadata in an annotation can be small or large, structured or unstructured, and can include characters not permitted by labels. It is possible to use labels as well as annotations in the metadata of the same object.

Annotations, like labels, are key/value maps:

Here are some examples of information that could be recorded in annotations:

Fields managed by a declarative configuration layer. Attaching these fields as annotations distinguishes them from default values set by clients or servers, and from auto-generated fields and fields set by auto-sizing or auto-scaling systems.

Build, release, or image information like timestamps, release IDs, git branch, PR numbers, image hashes, and registry address.

Pointers to logging, monitoring, analytics, or audit repositories.

Client library or tool information that can be used for debugging purposes: for example, name, version, and build information.

User or tool/system provenance information, such as URLs of related objects from other ecosystem components.

Lightweight rollout tool metadata: for example, config or checkpoints.

Phone or pager numbers of persons responsible, or directory entries that specify where that information can be found, such as a team web site.

Directives from the end-user to the implementations to modify behavior or engage non-standard features.

Instead of using annotations, you could store this type of information in an external database or directory, but that would make it much harder to produce shared client libraries and tools for deployment, management, introspection, and the like.

Syntax and character set

Annotations are key/value pairs. Valid annotation keys have two segments: an optional prefix and name, separated by a slash ( / ). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ( [a-z0-9A-Z] ) with dashes ( - ), underscores ( _ ), dots ( . ), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots ( . ), not longer than 253 characters in total, followed by a slash ( / ).

If the prefix is omitted, the annotation Key is presumed to be private to the user. Automated system components (e.g. kube-scheduler , kube-controller-manager , kube-apiserver , kubectl , or other third-party automation) which add annotations to end-user objects must specify a prefix.

The kubernetes.io/ and k8s.io/ prefixes are reserved for Kubernetes core components.

For example, here's a manifest for a Pod that has the annotation imageregistry: https://hub.docker.com/ :

What's next

  • Learn more about Labels and Selectors .
  • Find Well-known labels, Annotations and Taints

Was this page helpful?

Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on Stack Overflow . Open an issue in the GitHub Repository if you want to report a problem or suggest an improvement .

How-To Geek

Using kubernetes annotations, labels, and selectors.

4

Your changes have been saved

Email Is sent

Please verify your email address.

You’ve reached your account maximum for followed topics.

Google Drive Is Mysteriously Losing User Data (Updated)

What i'm hoping to see in the ipad mini 7, my favorite app for movies is discord, quick links, annotations.

Annotations, labels, and selectors are used to manage metadata attached to your Kubernetes objects. Annotations and labels define the data while selectors provide a way to query it.

Here are the differences between the three concepts, what they're designed for, and how you can use them to manage your resources.

The Kubernetes documentation defines annotations as "arbitrary non-identifying metadata" which you add to your objects. Their status as "non-identifying" means they aren't used internally by Kubernetes as part of its object selection system.

This means annotations are best used for data that's independent of the object and its role in your cluster. You could use them to add information about the tool that created an object, define who's responsible for its management, or add tags to be picked up by external tools.

There's no restrictions on what you use annotations for. As long as your data can be expressed as a key-value pair, you can create an annotation that encapsulates it. The model lets you store useful data directly alongside your objects, instead of having to refer to external documentation or databases.

Setting Annotations

Annotations are defined as part of a resource's metadata field. They're simple key-value pairs. The key needs to be 63 characters or less and can include alphanumeric characters, dashes, underscores, and dots. It must start and end with an alphanumeric character.

Keys also support an optional prefix which must be a valid DNS subdomain. Prefixes are used to namespace your annotation keys, avoiding collisions between common annotations like

. When a prefix is used, a slash character separates it from the key.

apiVersion: v1

name: pod-with-annotations

annotations:

unprefixed-annotation: "value"

cloudsavvyit.com/prefixed-annotation: "another value"

# <omitted>

This example demonstrates both prefixed and unprefixed annotations.

You can retrieve the annotations that have been set on an object using Kubectl . There's no built-in command so you need to get the JSON or YAML definition of the object, then extract the value of the

field. Here's an example that displays the annotations associated with the Pod shown above:

kubectl get pod pod-with-annotations -o jsonpath='{.metadata.annotations}'

Screenshot of getting annotations with Kubectl

Labels are another form of metadata which you can attach to your resources. The documentation describes the role of labels as "identifying attributes of objects that are meaningful and relevant to users" but independent of the properties of the core system.

Whereas annotations are intentionally purposeless, capable of representing any arbitrary data, labels are meant for more formal situations. They're commonly used to represent processes and organizational structures. You might use labels to denote a resource's release status (such as beta or stable ) or the development stage it maps to ( build or qa ).

Labels can be used as selectors when referencing objects. This is a key difference compared to annotations which aren't supported as selectors. Here's a Pod which selects Nodes that have the node-environment: production label:

name: pod-with-node-selector

containers:

nodeSelector:

node-environment: production

Setting Labels

Labels are attached to objects in the same way as annotations. Add a labels field to the object's metadata , then populate it with key-value pairs. Labels possess the same constraints around key names and prefixes.

name: pod-with-labels

cloudsavvyit.com/environment: stable

You can retrieve an object's labels using Kubectl with the same technique as shown earlier. Get the object's JSON representation, then extract the labels field:

kubectl get pod pod-with-labels -o jsonpath='{.metadata.labels}'

Kubectl also supports a --show-labels flag to include labels in human-readable output tables:

kubectl get pods --show-labels

Screenshot of getting labels with Kubectl

Selectors are used within Kubernetes object definitions to reference other objects. Different types of selectors are available to pull in objects that possess certain characteristics.

In the example above, we used a selector to identify Nodes with a particular label. Here's a Deployment object that uses an explicit label selector to identify the Pods it should manage:

apiVersion: apps/v1

kind: Deployment

name: deployment

matchLabels:

cloudsavvyit.com/app: selectors-demo

replicas: 3

The Deployment's template will create Pods that have the cloudsavvyit.com/app label set. These will be matched by the selector so they become part of the Deployment.

Selectors in Kubectl

You can use a form of selector to filter the objects that are returned by Kubectl:

kubectl get pods -l cloudsavvyit.com/app=selectors-demo

Label-based queries support several kinds of comparison operator. These include equality-based and set-based comparisons:

  • = - The label value is equal to a given value.
  • == - The label value is strictly equal to a given value.
  • != - The label value is not equal to a given value.
  • in - The label value is one of a set of given values.
  • notin - The label value is not in a set of given values.
  • exists - The label exists on the object.

Here's an example of using the in operator to query objects that are in the staging or production environments:

kubectl get pods -l "environment in (dev, production)"

Annotations and Labels are two ways to add metadata to your Kubernetes objects. Annotations are for non-identifying data that won't be referenced by Kubernetes. Labels are used to identify objects so that they can be selected by other Kubernetes resources.

It's best to use an annotation if you won't be querying for objects with the key-value pair. Use a label if you'll be referencing it within another resource or using it to filter Kubectl output in your terminal.

When working with labels, several forms of selector are available to help you access the data you need. Annotations are a little trickier to access as they're not meant to be queried but you can still list them by viewing the JSON representation of a Kubernetes object.

Understanding Labels and Annotations in Kubernetes

Last updated: March 18, 2024

kubectl get resource with annotation

  • Administration

1. Overview

Labels and annotations are popular tagging mechanisms in Kubernetes . Further, labels and annotations are both key-value pairs that we can use to tag metadata for resources such as pods. However, there are a few key differences too.

In this tutorial, our main objective is to compare labels with annotations in Kubernetes .

2. Format and Structure

At first glance, labels and annotations appear to have a similar structure, as both allow us to add metadata to a pod in the form of key-value pairs. However, in this section, we’ll learn how labels and annotations differ in structure.

Let’s start by noting that both labels and annotations have the same components for a key in the form of a prefix/name . While the prefix portion is optional and should be a valid DNS subdomain, the name portion is required and must be less than or equal to 63 characters. Further, the name must begin with an alphanumeric character, with a dash ( – ), underscore ( _ ), dot( . ), or alphanumeric characters in between :

So far, we can infer no difference between labels and annotations when considering the key part of the key-value pair. However, we must inspect the key-value pair’s value part to determine their significant differences.

Now, let’s go ahead and inspect the regular expression that Kubernetes uses to validate label values :

We can notice that label values can be empty , unlike label names. Besides that, they have the same restrictions, including a maximum length of 63 characters. On the other hand, annotation values are much more flexible and can contain multi-line strings with non-alphanumeric characters and symbols in addition to alphanumeric characters. Moreover, the annotation value can take up to 256KB , which allows us to store relatively large text.

Next, let’s define a few labels and annotations within an nginx pod’s manifest.yaml file:

Lastly, let’s create the pod using the manifest.yaml file, and inspect the labels and annotations in the pod:

Great! It looks like we’ve got this one right. Further, we must note that while we stored short and simple strings in labels, we used annotation to store an entire JSON object .

3. Querying and Filtering

As labels and annotations are tagging mechanisms, we can use either to filter the Kubernetes resources. However, Kubernetes maintains an internal label index , making labels more efficient for querying and filtering resources . So, Kubernetes recommends using labels for filtering and querying the resources wherever feasible.

Let’s start by using the kubectl command with the –selector flag to query for pods running the dashboard app:

The result looks as expected.

Next, let’s extend our query to include only those pods that are running in the test environment:

Perfect result! We must appreciate the fact that querying via labels is so convenient.

Lastly, let’s also see a scenario where we want to use build-info annotation to find out the pods running a specific code commit:

Although we could filter the pods using annotations, it required us to use the jq command as an external utility.

4. Integration With Controllers

For toy projects, running code within standalone pods might be okay. However, Kubernetes recommends running enterprise applications using controllers, such as Deployment , StatefulSet , Cronjob , and so on, that can ensure that the actual state of pods matches a desired state.

Further, the controllers manage the pod resources based on their labels using the selector and matchLabels field in the spec . However, such an integration isn’t available for annotations.

Let’s go ahead and create the deployment.yaml manifest file to run the dashboard app in the production environment while ensuring that there are three replicas available at any time:

We must note that the pod labels under the template field match the ones specified under the matchLabels field .

Next, let’s apply this manifest to create the frontend-nginx-deployment deployment that can manage the frontend-nginx containers:

As expected, we can see that Kubernetes is starting three pods through the deployment controller. Further, it’s useful to reiterate that the frontend-nginx-deployment deployment selects the pod resources to be managed using the label values in the matchLabels field in the specs of the selector field .

Lastly, let’s see the management of pods in action by deleting one of the pods and verifying the before-and-after state of the pods:

Fantastic! The frontend-nginx-deployment controller quickly detected that one of the pods was down, spawning a new pod as a replacement.

5. Conclusion

In this article, we used labels and annotations as key-value pairs to attach metadata to pods. Furthermore, we focused on identifying important differences between labels and annotations in terms of structure, accessibility, and direct integration with controllers .

kubectl get resource with annotation

Understanding and Using Kubernetes Annotations and Labels

Alexander Obregon

Alexander Obregon

Introduction

Kubernetes, the popular open-source container orchestration platform, has become an essential tool for managing, scaling, and deploying microservices. A significant part of Kubernetes’ functionality comes from its in-built object management systems, namely, Annotations and Labels. These features allow us to assign meaningful and relevant metadata to Kubernetes objects, thus enhancing the overall manageability of workloads. In this article, we’ll go into Kubernetes Annotations and Labels, and we’ll illustrate how to use them effectively.

Kubernetes Labels

Labels are key-value pairs attached to Kubernetes objects such as pods, services, and deployments. They are used to organize these objects based on user-defined criteria. The key aspect of labels is that they are meaningful and relevant to Kubernetes users, enabling them to query and select subsets of objects efficiently.

For instance, consider you have multiple pods running across different environments such as development, testing, and production. You can use labels to identify which environment each pod belongs to. Here is an example of how you can define a label when creating a pod:

You can then select the pods running in the production environment using kubectl with the following command:

Kubernetes Annotations

While labels provide a way to categorize Kubernetes objects, annotations let you add arbitrary, non-identifying metadata to objects. Unlike labels, annotations are not used to identify and select objects. Instead, they store additional information that may be useful for tools and libraries interacting with these objects.

For example, you may want to add a description, a timestamp for the last update, or a git commit hash to your Kubernetes objects. Here’s how you can define an annotation when creating a pod:

Annotations are entirely optional and can be as structured or unstructured as required. The values of annotations can be strings, numbers, or booleans, and they can even contain JSON.

Why Use Labels and Annotations?

The question may arise — why should we use labels and annotations in our Kubernetes clusters?

Improved Object Management

By using labels, you can manage Kubernetes objects at a higher level, irrespective of the lower-level details such as the specific nodes on which the pods are running. You can organize objects into groups and manage them collectively, which is a more efficient approach than dealing with individual objects.

Simplified Operations

With labels and label selectors, you can carry out bulk operations on Kubernetes objects. For example, you could update all pods with a particular label in a single command, thus simplifying operations.

Enhanced Interoperability

Annotations are used by external tools and libraries to operate seamlessly with Kubernetes objects. For instance, monitoring tools can use annotations to know what data to collect from a pod or a service.

Useful Debugging Information

Annotations can provide valuable metadata during the debugging process. An annotation that includes the last modified timestamp or the git commit hash can help track changes and investigate issues.

Managing and Updating Labels

Even after an object is created, labels on the object can be added or modified. This dynamic nature makes labels highly adaptable to the system’s needs. Here’s how to add a label using kubectl :

You can also modify an existing label:

To remove a label, you simply assign it no value:

Managing and Updating Annotations

Like labels, annotations can also be added or updated after object creation. Here’s how you can add an annotation:

To modify an existing annotation, use the same command:

To remove an annotation, assign it no value:

Use Cases for Labels and Annotations

Service discovery.

Labels are central to the Service discovery mechanism in Kubernetes. Services select underlying pods based on their labels. Therefore, by correctly labeling your pods, you can ensure that requests are correctly routed to the intended services.

Rolling Updates and Rollbacks

During a rolling update, Kubernetes uses labels to ensure that only a certain portion of pods are taken down and updated at a time. This mechanism relies on the correct assignment of labels.

Organizing Logs and Metrics

You can use labels to filter logs and metrics for specific Kubernetes objects. This is especially helpful in large, distributed systems where logs are generated by many different components.

Annotations for Tool Integrations

Many CI/CD tools and monitoring solutions use annotations to store metadata. For example, tools like Prometheus use annotations to determine which endpoints to scrape for metrics.

Understanding how to use labels and annotations effectively can significantly enhance your Kubernetes usage. Not only do they offer improved management and interoperability, but they also provide meaningful organization and filtering capabilities for better system understanding and debugging.

Kubernetes annotations and labels are a strong means of applying metadata to Kubernetes objects, making them more manageable, discoverable, and operational. By employing these features judiciously, you can greatly enhance your experience with Kubernetes, allowing for more efficient deployment, management, and troubleshooting of your applications. Whether you’re an operations engineer, a developer, or someone curious about Kubernetes, understanding labels and annotations will undoubtedly benefit you in your Kubernetes journey.

  • Kubernetes Documentation on Labels and Selectors
  • Kubernetes Documentation on Annotations
  • Kubernetes Labels and Selectors Guide
  • Kubernetes Annotations Guide

Alexander Obregon

Written by Alexander Obregon

Software Engineer, fervent coder & writer. Devoted to learning & assisting others. Connect on LinkedIn: https://www.linkedin.com/in/alexander-obregon-97849b229/

Text to speech

IMAGES

  1. Using Kubernetes Annotations, Labels, and Selectors

    kubectl get resource with annotation

  2. The Ultimate Kubectl Guide for Managing Kubernetes Objects Like a Pro

    kubectl get resource with annotation

  3. Kubernetes

    kubectl get resource with annotation

  4. Get CPU and Memory Usage of NODES and PODS

    kubectl get resource with annotation

  5. Get CPU and Memory Usage of NODES and PODS

    kubectl get resource with annotation

  6. Kubernetes Annotations

    kubectl get resource with annotation

VIDEO

  1. Incremental annotation processors compilation for Kotlin (KAPT)

  2. How To Use Remote Exec Provisioner In Terraform Hindi

  3. 25. @Resource -JSR-250 Annotation

  4. How To Install Docker and Kubernetes by Terraform Remote-Exec Provisioner Step by Step for Beginners

  5. Kubectl error upon applying agones fleet ensure CRDs are installed first

  6. I want to output the result of andquot kubectl get podandquot excluding the key using LabelSelector

COMMENTS

  1. kubernetes - Filter kubectl get based on annotation - Stack ...

    I would like to filter my kubectl get deploy command based on the value of an annotation. Something similar to kubectl get deploy --annotation stork.libopenstorage.org/skipresource!="true". Currently no clue how to do this and we don't want to add an extra label.

  2. Get Deployment annotation from a Kubernetes Pod

    As an alternative, you can leverage both using a kubectl selector to query all pods with label app=myapp and jq to query and format the resulting json to get you the name and annotations for each of the pods. kubectl get po -l app=myapp -o=json | jq '[. | {pod: .items[].metadata}][] | {name: .pod.name, annotations: .pod.annotations}'

  3. Kubernetes: query by annotation with kubectl | Fabian Lee ...

    Although kubectl has the native ability to query on labels, it does not provide the same support for annotations. This is unfortunate, because the need to target deployments and services by annotation is commonplace. You can, however, use the power of jsonpath to find these objects.

  4. kubectl annotate | Kubernetes

    Use "kubectl api-resources" for a complete list of supported resources. kubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version] Examples

  5. Annotations | Kubernetes

    You can use either labels or annotations to attach metadata to Kubernetes objects. Labels can be used to select objects and to find collections of objects that satisfy certain conditions. In contrast, annotations are not used to identify and select objects.

  6. Kubernetes Annotations: Metadata Mastery from Basic to ...

    2.2 Retrieving Annotations. To see a resource’s annotations: kubectl describe pod annotated-pod. Or using kubectl get with -o jsonpath: kubectl get pod annotated-pod -o=jsonpath='{.metadata ...

  7. kubectl: get filter by an annotations field - John Zen - Medium

    Jan 14. -- Filter by an annotations field e.g. kubernetes.io/psp: eks.privileged , print out kind , namesapce and name. kubectl get all -A \ -o=jsonpath='{range...

  8. Using Kubernetes Annotations, Labels, and Selectors - How-To Geek

    Use a label if you'll be referencing it within another resource or using it to filter Kubectl output in your terminal. When working with labels, several forms of selector are available to help you access the data you need.

  9. Understanding Labels and Annotations in Kubernetes - Baeldung

    Labels and annotations are popular tagging mechanisms in Kubernetes. Further, labels and annotations are both key-value pairs that we can use to tag metadata for resources such as pods. However, there are a few key differences too. In this tutorial, our main objective is to compare labels with annotations in Kubernetes. 2. Format and Structure.

  10. Annotations & Labels | Medium">Mastering Kubernetes Annotations & Labels | Medium

    Kubernetes Annotations. While labels provide a way to categorize Kubernetes objects, annotations let you add arbitrary, non-identifying metadata to objects. Unlike labels,...