我在容器服务 - Kubernetes 集群中创建了efk日志服务,现在fluentd启动报错:
2019-04-24 16:01:06 +0000 [error]: config error file="/etc/fluent/fluent.conf" error_class=Fluent::ConfigError error="Invalid Kubernetes API v1 endpoint https://10.253.0.1:443/api: SSL_connect returned=1 errno=0 state=error: certificate verify failed“
我查询了一些文档,有人说是需要添加证书,由于k8s是阿里直接创建好的,我试了/etc/kubernetes/pki下的所有正式,还是提示这个错误,证书已经复制的到了node节点。
node:
ls /etc/kubernetes/pki
apiserver-ca.crt apiserver.crt apiserver.key apiserver-kubelet-client.crt apiserver-kubelet-client.key ca.crt
这一套efk的yaml文件在我本地搭建的k8s集群部署没有任何问题!!!
fluentd部分配置:
containers:
- name: fluentd-es
image: gcr.azk8s.cn/fluentd-elasticsearch/fluentd:v2.5.1
env:
- name: FLUENTD_ARGS
value: --no-supervisor -q
resources:
limits:
memory: 500Mi
requests:
cpu: 100m
memory: 200Mi
volumeMounts:
- name: varlog
mountPath: /var/log
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
- name: config-volume
mountPath: /etc/fluent/config.d
- name: api-key
mountPath: /etc/kubernetes/pki
terminationGracePeriodSeconds: 30
volumes:
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
- name: api-key
hostPath:
path: /etc/kubernetes/pki
- name: config-volume
configMap:
name: fluentd-es-config-v0.2.0
configmap部分配置:
<filter kubernetes.**>
@id filter_kubernetes_metadata
@type kubernetes_metadata
ca_file /etc/kubernetes/pki/apiserver-ca.crt
client_cert /etc/kubernetes/pki/apiserver-kubelet-client.crt
client_key /etc/kubernetes/pki/apiserver-kubelet-client.key
</filter>