我在AWS中创建了ElasticSearch服务,并在kubernetes设置中将filebeat用作deamonset来转发日志。
下面是我的恶魔妖精Yaml:
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: filebeat
namespace: kube-system
labels:
k8s-app: filebeat
spec:
template:
metadata:
labels:
k8s-app: filebeat
spec:
serviceAccountName: filebeat
terminationGracePeriodSeconds: 30
containers:
- name: filebeat
image: docker.elastic.co/beats/filebeat:6.3.2
args: [
"-c", "/etc/filebeat.yml",
"-e",
]
env:
- name: ELASTICSEARCH_HOST
value: ${elasticsearch_host}
- name: ELASTICSEARCH_PORT
value: "443"
securityContext:
runAsUser: 0
resources:
limits:
memory: 256Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- name: config
mountPath: /etc/filebeat.yml
readOnly: true
subPath: filebeat.yml
- name: inputs
mountPath: /usr/share/filebeat/inputs.d
readOnly: true
- name: data
mountPath: /usr/share/filebeat/data
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
volumes:
- name: config
configMap:
defaultMode: 0600
name: filebeat-config
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
- name: inputs
configMap:
defaultMode: 0600
name: filebeat-inputs
# We set an `emptyDir` here to ensure the manifest will deploy correctly.
# It's recommended to change this to a `hostPath` folder, to ensure internal data
# files survive pod changes (ie: version upgrade)
- name: data
emptyDir: {}
Deamonset在K8中运行良好。我没有看到任何错误,但是在ELK中没有任何日志。当我检查Kibana时。我收到这个味精。
我在其他环境中使用了相同的filbeat yaml模板,但是当我刚刚创建新的Elasticsearch服务并使用新的端点转发日志时,它却无法正常工作。我还附上了对deamonset的描述。我在那里没有看到任何事件。可能是问题所在吗?