2 Kasım 2022 Çarşamba

Kubernetes kind : Deployment matchLabels Alanı

Giriş
Açıklaması şöyle. spec/selector altındadır
matchLabel: tells what pods the deployment will apply to.
Açıklaması şöyle
Only Job, Deployment, Replica Set, and Daemon Set support matchLabels.

Örnek
Şöyle yaparız
kind: Deployment
...
metadata:
  name: nginx
  labels:
    app: nginx
    tier: backend
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
        tier: backend
...
metadata Alanı
name ve labels deployment hakkında bilgi verir. Açıklaması şöyle
So, the first metadata describes the deployment itself. It gives a label for that actual deployment. So, if you want to delete that deployment, you would say kubectl delete -l app=nginx,tier=backend.
selector Alanı
selector altındaki matcLabels hangi podların seçileceğini belirtir. Açıklaması şöyle
... the second selector, is actually a selector for the deployment to apply to the pod that the deployment is describing.

template Alanı
- template ise çalıştırılacak pod'un özelliklerini belirtir. Açıklaması şöyle
The template is actually a podTemplate. It describes a pod that is launched. One of the fields for the pod templates is replicas. If we set replicas to 2, it would make 2 pods for that deployment, and the deployment would entail both of those pods. So, that template for the pod has a label. So, this isn’t a label for the deployment anymore, it’s a label for the pod that the deployment is deploying. That’s a subtle, but important distinction.


Hiç yorum yok:

Yorum Gönder

Cluster Propotional Autoscaler - ReplicaSet Ekler/Siler

Giriş Açıklaması şöyle CPA aims to horizontally scale the number of Pod replicas based on the cluster’s scale. A common example is DNS ser...