7 Haziran 2023 Çarşamba

Annotations

Giriş
Açıklaması şöyle
Annotations can be applied to a variety of Kubernetes resources, and are typically used for resources such as Pods, Services, Deployments, and Ingresses.

​The users of Kubernetes clusters are free to define and use Annotations, and they are usually customized for specific use cases or management needs.
metadata/annotations altında herhangi bir key: value string'i şeklinde tanımlanır

What are the similarities and differences between Annotations and Labels?
Açıklaması şöyle
Annotations and Labels are both key-value pairs used to attach metadata to Kubernetes objects like pods, services, and deployments. While they serve a similar purpose, there are some differences between annotations and labels.

Labels are primarily used for identifying and grouping resources within Kubernetes, while annotations are used to attach arbitrary metadata for external tools and systems to leverage. Labels have semantic meaning and are used by Kubernetes itself, whereas annotations are treated as opaque strings and have no impact on Kubernetes’ internal operations.
Örnek
Şöyle yaparız
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
  annotations:
    key1: value1
    key2: value2
spec:
  # The spec fields of the pod
Örnek
Şöyle yaparız
apiVersion: v1
kind: Pod metadata: name: annotations-demo annotations: imageregistry: "https://hub.docker.com/" spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80

kubectl cluster-info seçeneği

Cluster bilgisini gösterir