Kubernetes-DaemonSet
DaemonSet
DaemonSet:守护进程集,缩写为ds,在所有节点或者是匹配的节点上都部署一个Pod
# DaemonSet.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ds-test
labels:
app: filebeat
spec:
selector:
matchLabels:
app: filebeat
template:
metadata:
labels:
app: filebeat
spec:
containers:
- name: logs
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: varlog
mountPath: /tmp/log
volumes:
- name: varlog
hostPath:
path: /var/log
$ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
ds-test-59xv7 1/1 Running 0 85s 172.16.169.138 k8s-node2 <none> <none>
ds-test-6d6jz 1/1 Running 0 85s 172.16.235.195 k8s-master <none> <none>
ds-test-g9667 1/1 Running 0 85s 172.16.107.203 k8s-node3 <none> <none>
ds-test-rpjcq 1/1 Running 0 85s 172.16.36.73 k8s-node1 <none> <none>