新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
@@ -0,0 +1,39 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fluent-bit-config
|
||||
namespace: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
data:
|
||||
fluent-bit.conf: |
|
||||
[SERVICE]
|
||||
Flush 5
|
||||
Log_Level error
|
||||
Daemon off
|
||||
Parsers_File parsers.conf
|
||||
|
||||
@INCLUDE input.conf
|
||||
@INCLUDE output.conf
|
||||
|
||||
input.conf: |
|
||||
[INPUT]
|
||||
Name tail
|
||||
Tag kube.*
|
||||
Path /var/log/containers/timecheck*.log
|
||||
Parser docker
|
||||
Refresh_Interval 10
|
||||
|
||||
output.conf: |
|
||||
[OUTPUT]
|
||||
Name stdout
|
||||
Format json_lines
|
||||
Match kube.*
|
||||
|
||||
parsers.conf: |
|
||||
[PARSER]
|
||||
Name docker
|
||||
Format json
|
||||
Time_Key time
|
||||
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
||||
Time_Keep On
|
||||
@@ -0,0 +1,75 @@
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: fluent-bit
|
||||
namespace: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: fluent-bit
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: fluent-bit
|
||||
spec:
|
||||
serviceAccountName: fluent-bit
|
||||
containers:
|
||||
- name: fluent-bit
|
||||
image: fluent/fluent-bit:1.8.11
|
||||
volumeMounts:
|
||||
- name: fluent-bit-config
|
||||
mountPath: /fluent-bit/etc/
|
||||
- name: varlog
|
||||
mountPath: /var/log
|
||||
- name: varlibdockercontainers
|
||||
mountPath: /var/lib/docker/containers
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: fluent-bit-config
|
||||
configMap:
|
||||
name: fluent-bit-config
|
||||
- name: varlog
|
||||
hostPath:
|
||||
path: /var/log
|
||||
- name: varlibdockercontainers
|
||||
hostPath:
|
||||
path: /var/lib/docker/containers
|
||||
---
|
||||
# RBAC configuration - ignore this until we get to chapter 17 :)
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: fluent-bit
|
||||
namespace: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: fluent-bit
|
||||
labels:
|
||||
kiamol: ch13
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources:
|
||||
- namespaces
|
||||
- pods
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: fluent-bit
|
||||
labels:
|
||||
kiamol: ch13
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: fluent-bit
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: fluent-bit
|
||||
namespace: kiamol-ch13-logging
|
||||
@@ -0,0 +1,63 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fluent-bit-config
|
||||
namespace: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
data:
|
||||
fluent-bit.conf: |
|
||||
[SERVICE]
|
||||
Flush 5
|
||||
Log_Level error
|
||||
Daemon off
|
||||
Parsers_File parsers.conf
|
||||
|
||||
@INCLUDE input.conf
|
||||
@INCLUDE filter.conf
|
||||
@INCLUDE output.conf
|
||||
|
||||
input.conf: |
|
||||
[INPUT]
|
||||
Name tail
|
||||
Tag kube.<namespace_name>.<container_name>.<pod_name>.<docker_id>-
|
||||
Tag_Regex (?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\.log$
|
||||
Path /var/log/containers/*.log
|
||||
Parser docker
|
||||
Refresh_Interval 10
|
||||
|
||||
filter.conf: |
|
||||
[FILTER]
|
||||
Name kubernetes
|
||||
Match kube.*
|
||||
Kube_Tag_Prefix kube.
|
||||
Regex_Parser kube-tag
|
||||
|
||||
output.conf: |
|
||||
[OUTPUT]
|
||||
Name es
|
||||
Match kube.kiamol-ch13-test.*
|
||||
Host elasticsearch
|
||||
Index test
|
||||
Generate_ID On
|
||||
|
||||
[OUTPUT]
|
||||
Name es
|
||||
Match kube.kube-system.*
|
||||
Host elasticsearch
|
||||
Index sys
|
||||
Generate_ID On
|
||||
|
||||
parsers.conf: |
|
||||
[PARSER]
|
||||
Name docker
|
||||
Format json
|
||||
Time_Key time
|
||||
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
||||
Time_Keep On
|
||||
|
||||
[PARSER]
|
||||
Name kube-tag
|
||||
Format regex
|
||||
Regex ^(?<namespace_name>[^_]+)\.(?<container_name>.+)\.(?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)\.(?<docker_id>[a-z0-9]{64})-$
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fluent-bit-config
|
||||
namespace: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
data:
|
||||
fluent-bit.conf: |
|
||||
[SERVICE]
|
||||
Flush 5
|
||||
Log_Level error
|
||||
Daemon off
|
||||
Parsers_File parsers.conf
|
||||
|
||||
@INCLUDE input.conf
|
||||
@INCLUDE filter.conf
|
||||
@INCLUDE output.conf
|
||||
|
||||
input.conf: |
|
||||
[INPUT]
|
||||
Name tail
|
||||
Tag kube.<namespace_name>.<container_name>.<pod_name>.<docker_id>-
|
||||
Tag_Regex (?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\.log$
|
||||
Path /var/log/containers/*.log
|
||||
Parser docker
|
||||
Refresh_Interval 10
|
||||
|
||||
filter.conf: |
|
||||
[FILTER]
|
||||
Name kubernetes
|
||||
Match kube.*
|
||||
Kube_Tag_Prefix kube.
|
||||
Regex_Parser kube-tag
|
||||
Annotations Off
|
||||
Merge_Log On
|
||||
K8S-Logging.Parser On
|
||||
|
||||
[FILTER]
|
||||
Name grep
|
||||
Match kube.kiamol-ch13-test.api.numbers-api*
|
||||
Regex priority [234]
|
||||
|
||||
output.conf: |
|
||||
[OUTPUT]
|
||||
Name es
|
||||
Match kube.kiamol-ch13-test.*
|
||||
Host elasticsearch
|
||||
Index test
|
||||
Generate_ID On
|
||||
|
||||
[OUTPUT]
|
||||
Name es
|
||||
Match kube.kube-system.*
|
||||
Host elasticsearch
|
||||
Index sys
|
||||
Generate_ID On
|
||||
|
||||
parsers.conf: |
|
||||
[PARSER]
|
||||
Name docker
|
||||
Format json
|
||||
Time_Key time
|
||||
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
||||
Time_Keep On
|
||||
|
||||
[PARSER]
|
||||
Name kube-tag
|
||||
Format regex
|
||||
Regex ^(?<namespace_name>[^_]+)\.(?<container_name>.+)\.(?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)\.(?<docker_id>[a-z0-9]{64})-$
|
||||
|
||||
[PARSER]
|
||||
Name nginx
|
||||
Format regex
|
||||
Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
|
||||
Time_Key time
|
||||
Time_Format %d/%b/%Y:%H:%M:%S %z
|
||||
|
||||
[PARSER]
|
||||
Name dotnet-syslog
|
||||
Format regex
|
||||
Regex ^\<(?<priority>[0-9]+)\>*(?<message>.*)$
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fluent-bit-config
|
||||
namespace: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
data:
|
||||
fluent-bit.conf: |
|
||||
[SERVICE]
|
||||
Flush 5
|
||||
Log_Level error
|
||||
Daemon off
|
||||
Parsers_File parsers.conf
|
||||
|
||||
@INCLUDE input.conf
|
||||
@INCLUDE filter.conf
|
||||
@INCLUDE output.conf
|
||||
|
||||
input.conf: |
|
||||
[INPUT]
|
||||
Name tail
|
||||
Tag kube.<namespace_name>.<container_name>.<pod_name>.<docker_id>-
|
||||
Tag_Regex (?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\.log$
|
||||
Path /var/log/containers/*.log
|
||||
Parser docker
|
||||
Refresh_Interval 10
|
||||
|
||||
filter.conf: |
|
||||
[FILTER]
|
||||
Name kubernetes
|
||||
Match kube.*
|
||||
Kube_Tag_Prefix kube.
|
||||
Regex_Parser kube-tag
|
||||
|
||||
output.conf: |
|
||||
[OUTPUT]
|
||||
Name stdout
|
||||
Format json_lines
|
||||
Match kube.kiamol-ch13-test.*
|
||||
|
||||
[OUTPUT]
|
||||
Name counter
|
||||
Match kube.kiamol-ch13-dev.*
|
||||
|
||||
parsers.conf: |
|
||||
[PARSER]
|
||||
Name docker
|
||||
Format json
|
||||
Time_Key time
|
||||
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
||||
Time_Keep On
|
||||
|
||||
[PARSER]
|
||||
Name kube-tag
|
||||
Format regex
|
||||
Regex ^(?<namespace_name>[^_]+)\.(?<container_name>.+)\.(?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)\.(?<docker_id>[a-z0-9]{64})-$
|
||||
@@ -0,0 +1,53 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fluent-bit-config
|
||||
namespace: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
data:
|
||||
fluent-bit.conf: |
|
||||
[SERVICE]
|
||||
Flush 5
|
||||
Log_Level error
|
||||
Daemon off
|
||||
Parsers_File parsers.conf
|
||||
|
||||
@INCLUDE input.conf
|
||||
@INCLUDE filter.conf
|
||||
@INCLUDE output.conf
|
||||
|
||||
input.conf: |
|
||||
[INPUT]
|
||||
Name tail
|
||||
Tag kube.<namespace_name>.<container_name>.<pod_name>.<docker_id>-
|
||||
Tag_Regex (?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\.log$
|
||||
Path /var/log/containers/*.log
|
||||
Parser docker
|
||||
Refresh_Interval 10
|
||||
|
||||
filter.conf: |
|
||||
[FILTER]
|
||||
Name kubernetes
|
||||
Match kube.*
|
||||
Kube_Tag_Prefix kube.
|
||||
Regex_Parser kube-tag
|
||||
|
||||
output.conf: |
|
||||
[OUTPUT]
|
||||
Name stdout
|
||||
Format json_lines
|
||||
Match kube.kiamol-ch13-test.*
|
||||
|
||||
parsers.conf: |
|
||||
[PARSER]
|
||||
Name docker
|
||||
Format json
|
||||
Time_Key time
|
||||
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
||||
Time_Keep On
|
||||
|
||||
[PARSER]
|
||||
Name kube-tag
|
||||
Format regex
|
||||
Regex ^(?<namespace_name>[^_]+)\.(?<container_name>.+)\.(?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)\.(?<docker_id>[a-z0-9]{64})-$
|
||||
@@ -0,0 +1,79 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fluent-bit-config
|
||||
namespace: kiamol-ch13-logging
|
||||
labels:
|
||||
kiamol: ch13
|
||||
data:
|
||||
fluent-bit.conf: |
|
||||
[SERVICE]
|
||||
Flush 5
|
||||
Log_Level error
|
||||
Daemon off
|
||||
Parsers_File parsers.conf
|
||||
|
||||
@INCLUDE input.conf
|
||||
@INCLUDE filter.conf
|
||||
@INCLUDE output.conf
|
||||
|
||||
input.conf: |
|
||||
[INPUT]
|
||||
Name tail
|
||||
Tag kube.<namespace_name>.<container_name>.<pod_name>.<docker_id>-
|
||||
Tag_Regex (?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\.log$
|
||||
Path /var/log/containers/*.log
|
||||
Parser docker
|
||||
Refresh_Interval 10
|
||||
|
||||
filter.conf: |
|
||||
[FILTER]
|
||||
Name kubernetes
|
||||
Match kube.*
|
||||
Kube_Tag_Prefix kube.
|
||||
Regex_Parser kube-tag
|
||||
Annotations Off
|
||||
Merge_Log On
|
||||
K8S-Logging.Parser On
|
||||
|
||||
output.conf: |
|
||||
[OUTPUT]
|
||||
Name es
|
||||
Match kube.kiamol-ch13-test.*
|
||||
Host elasticsearch
|
||||
Index test
|
||||
Generate_ID On
|
||||
|
||||
[OUTPUT]
|
||||
Name es
|
||||
Match kube.kube-system.*
|
||||
Host elasticsearch
|
||||
Index sys
|
||||
Generate_ID On
|
||||
|
||||
parsers.conf: |
|
||||
[PARSER]
|
||||
Name docker
|
||||
Format json
|
||||
Time_Key time
|
||||
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
||||
Time_Keep On
|
||||
|
||||
[PARSER]
|
||||
Name kube-tag
|
||||
Format regex
|
||||
Regex ^(?<namespace_name>[^_]+)\.(?<container_name>.+)\.(?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)\.(?<docker_id>[a-z0-9]{64})-$
|
||||
|
||||
[PARSER]
|
||||
Name nginx
|
||||
Format regex
|
||||
Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
|
||||
Time_Key time
|
||||
Time_Format %d/%b/%Y:%H:%M:%S %z
|
||||
|
||||
[PARSER]
|
||||
Name dotnet-syslog
|
||||
Format regex
|
||||
Regex ^\<(?<priority>[0-9]+)\>*(?<message>.*)$
|
||||
Time_Key time
|
||||
Time_Format %b %d %H:%M:%S
|
||||
Reference in New Issue
Block a user