DaemonSet:每個節點都運行一個Pod
目錄
- DaemonSet:每個節點都運行一個Pod
- 在每個節點上運行一個pod
- 使用DaemonSet只在特定節點上起pod
- 使用高級調度限制pod在節點上運行
- 使用nodeSelector來限制pod可以運行的節點
- 思考:高級調度和nodeSelector的優先級?
依舊從這里開始:
kubectl explain daemonset.spec
一個基礎daemonset yaml,
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ssd-monitor
namespace: controller-test
spec:
selector:
matchLabels:
app: ssd-monitor
template:
metadata:
labels:
app: ssd-monitor
spec:
containers:
- name: main
image: luksa/ssd-monitor
指定.spec.selector來確定這個DaemonSet物件管理的Pod,通常與.spec.template.metadata.labels中定義的Pod的label一致,
在每個節點上運行一個pod
在節點沒有特殊調度的情況下,一個pod對應一個節點
- 節點丟失,該節點對應的pod不會在其他節點上重建
- 新加入的節點,會自動在改節點上部署一個pod
使用DaemonSet只在特定節點上起pod
使用高級調度限制pod在節點上運行
待學習
使用nodeSelector來限制pod可以運行的節點
如,只在node標簽有 daemonset=true 的節點上運行pod:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ssd-monitor-nodelabel
namespace: controller-test
spec:
selector:
matchLabels:
app: ssd-monitor-nodelabel
template:
metadata:
labels:
app: ssd-monitor-nodelabel
spec:
nodeSelector:
daemonset: "true" # 有一些特殊的需要加""
containers:
- name: main
image: luksa/ssd-monitor
思考:高級調度和nodeSelector的優先級?
也就是說如果高級調度不讓在改node上運行pod,但改node上打標簽了
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/73641.html
標籤:其他
