【发布时间】:2021-09-03 14:41:22
【问题描述】:
我在 Azure Kubernetes 服务上作为 DaemonSet 运行 Fluent Bit,输出到 Azure Log Analytics。一旦 Fluent Bit 尝试发送日志,它就无法连接 DNS 服务器:
getaddrinfo(host='XXX.ods.opinsights.azure.com', err=12): Timeout while contacting DNS servers
如果我手动输入 IP 和 XXX.ods.opinsights.azure.com 到 /etc/hosts,一切顺利。
如果我 ssh 到 fluent-bit pod 并运行 wget XXX.ods.opinsights.azure.com 主机解析也可以。
可能有什么问题?
我的配置:
配置映射
- apiVersion: v1
kind: ConfigMap
metadata:
name: fluent-bit-config
namespace: airflow
labels:
k8s-app: fluent-bit
data:
fluent-bit.conf: |
[SERVICE]
Flush 1
Log_Level info
Daemon off
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
@INCLUDE input-kubernetes.conf
@INCLUDE filter-kubernetes.conf
@INCLUDE output-azure.conf
input-kubernetes.conf: |
[INPUT]
Name tail
Tag kube.*
Path /var/log/containers/*.log
DB /var/log/flb_kube.db
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Refresh_Interval 10
filter-kubernetes.conf: |
[FILTER]
Name kubernetes
Match kube.*
Kube_URL https://kubernetes.default.svc:443
Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token
Merge_Log On
K8S-Logging.Parser Off
K8S-Logging.Exclude Off
output-azure.conf: |
[OUTPUT]
Name azure
Match *
Customer_ID xxx
Shared_Key yyy
守护进程
- apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentbit
namespace: airflow
labels:
app.kubernetes.io/name: fluentbit
spec:
selector:
matchLabels:
name: fluentbit
template:
metadata:
labels:
name: fluentbit
spec:
serviceAccountName: fluent-bit
containers:
- name: fluent-bit
imagePullPolicy: Always
image: fluent/fluent-bit:1.8-debug
volumeMounts:
- name: varlog
mountPath: /var/log
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
- name: fluent-bit-config
mountPath: /fluent-bit/etc/
resources:
limits:
memory: 1500Mi
requests:
cpu: 500m
memory: 500Mi
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
volumes:
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
- name: fluent-bit-config
configMap:
name: fluent-bit-config
【问题讨论】:
标签: azure-aks fluent-bit