Quando utilizar: quando for preciso algo a nivel do host
para ver o atalho do comando e versão: exemplo ds atalho versão apps/v1
k api-resources | grep -i daemon = atalho ds
Ver os daemonsets de todo o cluster
k get ds -A
no host (node) – /var/log/container >> /var/log/pod
k get ds -n efk fluentd -oyaml | kubectl neat
Obs – não é possível criar um daemonset com kubectl create, solução usar o comando pra criar um deployment e alterar.
k create deployment --image nginx nginx --dry-run -oyaml | kubectl neat > daemonset.yaml
para confirmar atalhos e qual a versão esta utilizando neste caso o apps/va.
k api-resources | grep -i daemon
Se tiver duvidas do que add usar o
kubectl explain daemonset
Criar o arquivo
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: nginx
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx
name: nginx
nodeSelector:
kubernetes.io/hostname: worker-1
Comandos úteis
k apply - f daemonset.yaml
k get ds
k get po
k get node -owide
OBS: usar node selector para selecionar nodes especificos para subidas:
k get node --show-labels