ref: https://blog.kubecost.com/blog/kubernetes-labels/
本篇文章是一個 Kubernetes Label 介紹文, Kubernetes 的使用者一定都知道 Kubernetes 內的物件很大量依賴 Label 的使用,最基本的用法就是
Deployment 與 Pod 之間是透過 Label 與 LabelSelector 互相溝通的。
Kubernetes 提供兩種不同的方式來為資源打上標記,分別是
1. labels
2. annotations
兩者都是基於 key/value 的方式來設定,不過用途是完全不同。 Label 主要是用來提供辨識的功能,讓使用者可以透過 key/value 的方式來辨識當前的資源,就如同前述提到的 Deployment 與 Pod 的關係。
透過 Label 來標示 Pod,而 Deployment 則透過 LabelSelector 來選擇符合標準的 Pod。
Label 主要有兩大用法
1. Grouping Resource for Queries
2. Bulk Operations.
第一種用法就是前述提到的,將一群資源透過 Label 給標記起來,另外一個則是透過 kubectl 等指令操作時,可以一口氣操作多個資源,譬如
kubectl delete deployment -l environment in (dev,sit)
上述資源可以一口氣將符合 environmnet=dev 以及 environmnet=sit 的 deployment 給一次刪除。
文章中還列舉了其他介紹與學習 Labeling 概念的網站,最後還提到一個使用 Label 上要注意的相關事項
1. 不要將一些會一直改變的資料放到 Label 中
2. 沒有任何理由的話,不要輕易去修改運行資源的 Label 內容
3. Label 本身的設計不是一個 data store,所以不要將一些 Application 的重要資料給存放到 Label 上
對於 Label 這概念想要更深理解的可以參閱全文
同時也有10000部Youtube影片,追蹤數超過2,910的網紅コバにゃんチャンネル,也在其Youtube影片中提到,...
「kubectl delete pod」的推薦目錄:
- 關於kubectl delete pod 在 矽谷牛的耕田筆記 Facebook 的最佳解答
- 關於kubectl delete pod 在 コバにゃんチャンネル Youtube 的最佳解答
- 關於kubectl delete pod 在 大象中醫 Youtube 的最佳解答
- 關於kubectl delete pod 在 大象中醫 Youtube 的精選貼文
- 關於kubectl delete pod 在 kubectl delete - Kubernetes 的評價
- 關於kubectl delete pod 在 How to list Kubernetes recently deleted pods? - Stack Overflow 的評價
- 關於kubectl delete pod 在 A simply script to delete all failed pods from Kubernetes - gists ... 的評價
kubectl delete pod 在 コバにゃんチャンネル Youtube 的最佳解答
kubectl delete pod 在 大象中醫 Youtube 的最佳解答
kubectl delete pod 在 大象中醫 Youtube 的精選貼文
kubectl delete pod 在 How to list Kubernetes recently deleted pods? - Stack Overflow 的推薦與評價
... <看更多>
kubectl delete pod 在 A simply script to delete all failed pods from Kubernetes - gists ... 的推薦與評價
kubectl --namespace=production get pods -a | grep Evicted | awk '{print $1}' | xargs kubectl --namespace=production delete pod -o name. ... <看更多>
kubectl delete pod 在 kubectl delete - Kubernetes 的推薦與評價
Delete a pod using the type and name specified in pod.json. kubectl delete -f . ... "foo" kubectl delete pod,service baz foo # Delete pods and services with ... ... <看更多>