🏷️Label ve Selector
example.com/tier:frontend
prefix Key Value
Prefix kısmı opsiyoneldir.kubectl get pods -L "app"
# app etiketine sahip podları getirir. --show-label parametresini eklersek, mevcut
etiketleride gösterir.
kubectl get pods -L "app:firstapp" --show-labels
# App etiketine sahip ve firstapp değerine sahip podları getirir.
# Daha fazla etikete göre aramak için tırnak arasına , işareti koyup, 2.istediğimiz
etiketide arayabiliriz.
"app:firstapp,tier:frontend"
"app:firstapp,tier!=frontend"
# Tier etiketi frontend değeri olmayan,değeri bul ve o podları getir.
kubectl get pods -L "app in (firstapp)" --show-label
# App anahtarına firstapp değeri olan podları getir.
"app in (firstapp,secondapp)"
# APP değeri firstapp veya secondapp olan podları listele.
"app notin (firstapp)"
# App anahtarının değeri firstapp olmayan podları listele.
"app in (firstapp),tier notin(frontend)"
# app anahtarının değeri firstapp olacak, tier etiketinin değeri frontend olmayan
podları getir.
kubectl label pods pod9 app=thirdapp
# Pod9 poduna etiket ekledik.
# Etiket güncellemelerini yml dosyasını güncelleyerek yapabiliriz.
kubectl label pods pod9 app -
# Label'i sildik.
kubectl label --overwrite pods pod9 team=teams3
# etkiketi güncelledik.
kubectl label pods -all foo:bar
# Tüm namespace altında bulunan podlara etiket eklemek için.Last updated