增加EFK插件的原理介绍
parent
6317d87acb
commit
f9025ee144
|
@ -0,0 +1,56 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: fluentd-es-v1.22
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: fluentd-es
|
||||
kubernetes.io/cluster-service: "true"
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
version: v1.22
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: fluentd-es
|
||||
kubernetes.io/cluster-service: "true"
|
||||
version: v1.22
|
||||
# This annotation ensures that fluentd does not get evicted if the node
|
||||
# supports critical pod annotation based priority scheme.
|
||||
# Note that this does not guarantee admission on the nodes (#40573).
|
||||
annotations:
|
||||
scheduler.alpha.kubernetes.io/critical-pod: ''
|
||||
spec:
|
||||
serviceAccountName: efk
|
||||
containers:
|
||||
- name: fluentd-es
|
||||
image: sz-pg-oam-docker-hub-001.tendcloud.com/library/fluentd-elasticsearch:1.22
|
||||
command:
|
||||
- '/bin/sh'
|
||||
- '-c'
|
||||
- '/usr/sbin/td-agent 2>&1 >> /var/log/fluentd.log'
|
||||
resources:
|
||||
limits:
|
||||
memory: 200Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 200Mi
|
||||
volumeMounts:
|
||||
- name: varlog
|
||||
mountPath: /var/log
|
||||
- name: varlibdockercontainers
|
||||
mountPath: /var/lib/docker/containers
|
||||
readOnly: true
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/fluentd-ds-ready: "true"
|
||||
tolerations:
|
||||
- key : "node.alpha.kubernetes.io/ismaster"
|
||||
effect: "NoSchedule"
|
||||
terminationGracePeriodSeconds: 30
|
||||
volumes:
|
||||
- name: varlog
|
||||
hostPath:
|
||||
path: /var/log
|
||||
- name: varlibdockercontainers
|
||||
hostPath:
|
||||
path: /var/lib/docker/containers
|
|
@ -1,5 +1,7 @@
|
|||
# 安装EFK插件
|
||||
|
||||
我们通过在每台node上部署一个以DaemonSet方式运行的fluentd来收集每台node上的日志。Fluentd将docker日志目录`/var/lib/docker/containers`和`/var/log`目录挂载到Pod中,然后Pod会在node节点的`/var/log/pods`目录中创建新的目录,可以区别不同的容器日志输出,该目录下有一个日志文件链接到`/var/lib/docker/contianers`目录下的容器日志输出。
|
||||
|
||||
官方文件目录:`cluster/addons/fluentd-elasticsearch`
|
||||
|
||||
``` bash
|
||||
|
@ -9,7 +11,7 @@ es-controller.yaml es-service.yaml fluentd-es-ds.yaml kibana-controller.yaml
|
|||
|
||||
同样EFK服务也需要一个`efk-rbac.yaml`文件,配置serviceaccount为`efk`。
|
||||
|
||||
已经修改好的 yaml 文件见:[EFK](./manifests/EFK)
|
||||
已经修改好的 yaml 文件见:[EFK](../manifests/EFK)
|
||||
|
||||
|
||||
## 配置 es-controller.yaml
|
||||
|
|
Loading…
Reference in New Issue