...
Code Block |
---|
language | bash |
---|
title | FilebeatDownload filebeat |
---|
|
$ curl -LO https://raw.githubusercontent.com/elastic/beats/7.8/deploy/kubernetes/filebeat-kubernetes.yaml |
and modify the lines highlighted by the comments in the following extract (to allow the creation of Pods also on the master, add the lines shown at the bottom)
No Format |
---|
output.elasticsearch:
hosts:['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:92}'] # <--- Enter the desired port
username: ${ELASTICSEARCH_USERNAME}
password: ${ELASTICSEARCH_PASSWORD}
-----------------------------------------------------
env:
name: ELASTICSEARCH_HOST
value: 131.154.97.128 # <--- Enter the host FIP with elasticsearch
name: ELASTICSEARCH_PORT
value: "92" # <--- Enter the port (like above)
name: ELASTICSEARCH_USERNAME
value: elastic
name: ELASTICSEARCH_PASSWORD
value: changeme
name: ELASTIC_CLOUD_ID
value:
name: ELASTIC_CLOUD_AUTH
value:
name: NODE_NAME
-----------------------------------------------------
# this toleration is to have the daemonset runnable on master nodes. Remove it if your masters can't run pods
spec:
template:
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule |
Finally, launch FileBeat as DaemonSet, which ensures that there is an agent for each node of the Kubernetes cluster
Code Block |
---|
language | bash |
---|
title | Lanch filebeat |
---|
|
$ kubectl create -f filebeat-kubernetes.yaml
configmap/filebeat-config created
daemonset.apps/filebeat created
clusterrolebinding.rbac.authorization.k8s.io/filebeat created
clusterrole.rbac.authorization.k8s.io/filebeat created
serviceaccount/filebeat created |
To consult the cluster DaemonSets, run the command
Code Block |
---|
language | bash |
---|
title | Check DaemonSet |
---|
|
$ kubectl get daemonset --all-namespaces
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system calico-node 3 3 3 3 3 kubernetes.io/os=linux 13d
kube-system filebeat 3 3 3 3 3 <none> 8m26s
kube-system kube-proxy 3 3 3 3 3 kubernetes.io/os=linux 13d |
To remove the DaemonSet use the command (or via the Kubernetes dashboard)
Code Block |
---|
language | bash |
---|
title | Remove DaemonSet |
---|
|
$ kubectl delete daemonset <ds> --namespace=<ns>
daemonset.apps "filebeat" deleted |