mchudinov
(Mikael Chudinov)
January 26, 2021, 3:21pm
1
How to remove a Metricbeat daemonset created with yaml:
apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
name: metricbeat
namespace: myspace
spec:
type: metricbeat
version: 7.10.2
elasticsearchRef:
name: elasticsearch
kibanaRef:
name: kibana
A simple command does not help
kubectl delete -n myspace daemonset metricbeat-beat-metricbeat --force
Pods of this beat are in CrashLoopBackOff state because they do not recognize Kibana SSL which is configured for public domain, not for Kubernetes.
Btw, it would be good to have an option for Beats.
ssl.verification_mode: "none"
mchudinov
(Mikael Chudinov)
January 26, 2021, 11:40pm
2
I have just started a Filebeat daemonset. It works, all pods are green.
But how to delete it?
The standard command can't delete it.
kubectl delete -n myspace daemonset filebeat-beat-filebeat
Damonset with Filebeat pods is automatically recreated!
apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
name: filebeat
namespace: myspace
spec:
type: filebeat
version: 7.10.2
elasticsearchRef:
name: elasticsearch
config:
filebeat.autodiscover.providers:
- node: ${NODE_NAME}
type: kubernetes
hints.default_config.enabled: "false"
templates:
- condition.equals.kubernetes.namespace: log-namespace
config:
- paths: ["/var/log/containers/*${data.kubernetes.container.id}.log"]
type: container
- condition.equals.kubernetes.labels.log-label: "true"
config:
- paths: ["/var/log/containers/*${data.kubernetes.container.id}.log"]
type: container
processors:
- add_cloud_metadata: {}
- add_host_metadata: {}
daemonSet:
podTemplate:
spec:
serviceAccountName: filebeat
automountServiceAccountToken: true
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true # Allows to provide richer host metadata
containers:
- name: filebeat
securityContext:
runAsUser: 0
resources:
limits:
memory: 200Mi
cpu: 200m
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- name: varlogcontainers
mountPath: /var/log/containers
- name: varlogpods
mountPath: /var/log/pods
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumes:
- name: varlogcontainers
hostPath:
path: /var/log/containers
- name: varlogpods
hostPath:
path: /var/log/pods
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
Hi,
The DaemonSet is managed by the Beat you created. If you want to delete the DaemonSet you must delete the Beat: kubectl delete beat/filebeat -n myspace
mchudinov
(Mikael Chudinov)
January 27, 2021, 12:01pm
4
Thank you! It works.
It should be noticed in the documentation.