Commit e051e7e1 by 蒋勇

d

parent ac3b0c19
...@@ -604,7 +604,7 @@ spec: ...@@ -604,7 +604,7 @@ spec:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: metadata.namespace fieldPath: metadata.namespace
image: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.6.2 image: registry.cn-beijing.aliyuncs.com/hantang2/staticngnix:ingctl
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
livenessProbe: livenessProbe:
failureThreshold: 3 failureThreshold: 3
......
apiVersion: v1
kind: ServiceAccount
metadata:
name: fluentd
namespace: logging
labels:
k8s-app: fluentd
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fluentd
labels:
k8s-app: fluentd
rules:
- apiGroups:
- ""
resources:
- "namespaces"
- "pods"
verbs:
- "get"
- "watch"
- "list"
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fluentd
labels:
k8s-app: fluentd
subjects:
- kind: ServiceAccount
name: fluentd
namespace: logging
apiGroup: ""
roleRef:
kind: ClusterRole
name: fluentd
apiGroup: ""
\ No newline at end of file
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd
namespace: logging
labels:
k8s-app: fluentd
annotations:
reloader.stakater.com/auto: "true"
spec:
selector:
matchLabels:
k8s-app: fluentd
template:
metadata:
labels:
k8s-app: fluentd
kubernetes.io/cluster-service: "true"
spec:
# priorityClassName: system-node-critical
serviceAccountName: fluentd
containers:
- name: fluentd
image: registry.cn-beijing.aliyuncs.com/hantang2/esfluentd:v1
imagePullPolicy: Always
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 200Mi
volumeMounts:
- name: config-volume
mountPath: /fluentd/etc/conf.d
terminationGracePeriodSeconds: 30
volumes:
- name: config-volume
configMap:
name: fluentd-config
kind: ConfigMap
apiVersion: v1
metadata:
name: fluentd-config
namespace: logging
data:
system.conf: |-
<system>
root_dir /tmp/fluentd-buffers/
</system>
main.conf: |-
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<filter *.ctag>
@type parser
key_name log
<parse>
@type regexp
expression /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)$/
time_format %d/%b/%Y:%H:%M:%S %z
</parse>
</filter>
<filter *.ctag>
@type elasticsearch_genid
hash_id_key _hash # storing generated hash id key (default is _hash)
</filter>
<filter *.ctag>
@type record_transformer
<record>
appname ${tag}
</record>
</filter>
<match *.ctag>
@type elasticsearch
id_key _hash
remove_keys _hash
host 192.168.4.249
port 9200
logstash_format true
logstash_prefix ${tag}
request_timeout 60s
<buffer tag>
@type file
chunk_limit_size 4M
flush_interval 15s
path /fluentd/log/app_${tag}_${chunk_id}
pos_file ${path}.ops
retry_wait 30 # The wait interval for the first retry.
retry_exponential_backoff_base 2 # Increase the wait time by a factor of N.
retry_type exponential_backoff # Set 'periodic' for constant intervals.
# retry_max_interval 1h # Cap the wait interval. (see above)
retry_randomize true # Apply randomization. (see above)
retry_timeout 72h # Maximum duration before giving up.
retry_max_times 3 # Maximum retry count before giving up.
retry_forever false # Set 'true' for infinite retry loops.
</buffer>
</match>
<match **>
@type rewrite_tag_filter
<rule>
key container_name
pattern ^\/(\w+)$
tag $1.ctag
</rule>
# more rules
</match>
# kind: ConfigMap
# apiVersion: v1
# metadata:
# name: fluentd-config-main-v1
# namespace: logging
# data:
# fluent.conf: |-
# @include conf.d/*.conf
\ No newline at end of file
apiVersion: v1
kind: Namespace
metadata:
name: logging
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment