add logstash

main
ycz008 2023-09-22 16:55:55 +08:00
parent a9fff3511c
commit efded28182
2 changed files with 110 additions and 23 deletions

View File

@ -7,21 +7,7 @@ data:
server.name: kibana
server.host: 0.0.0.0
elasticsearch.hosts: [ "http://elastic:9200" ]
---
apiVersion: v1
kind: Service
metadata:
name: kibana
labels:
app: kibana
spec:
ports:
- port: 5601
targetPort: 5601
nodePort: 30013
selector:
app: kibana
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
@ -42,11 +28,8 @@ spec:
containers:
- name: kibana
image: docker.elastic.co/kibana/kibana:7.16.3
volumeMounts:
- name: config
mountPath: /usr/share/kibana/config/kibana.yml
subPath: kibana.yml
readOnly: true
ports:
- containerPort: 5601
resources:
requests:
cpu: 100m
@ -54,12 +37,31 @@ spec:
limits:
cpu: 1
memory: 1Gi
ports:
- containerPort: 5601
volumeMounts:
- name: config
mountPath: /usr/share/kibana/config/kibana.yml
subPath: kibana.yml
readOnly: true
volumes:
- name: config
configMap:
name: kibana-config
items:
- key: kibana.yml
path: kibana.yml
path: kibana.yml
---
apiVersion: v1
kind: Service
metadata:
name: kibana
labels:
app: kibana
spec:
ports:
- port: 5601
targetPort: 5601
nodePort: 30013
selector:
app: kibana
type: NodePort

View File

@ -0,0 +1,85 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: logstash-config
data:
logstash.conf: |-
input {
beats {
port => 5044
}
}
filter {
if [tags][json] {
json {
source => "message"
}
}
}
output {
stdout { codec => rubydebug }
elasticsearch {
hosts => ["http://elastic:9200"]
index => "dev-logback-beaconfire-%{+YYYY.MM.dd}"
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: logstash
labels:
app: logstash
spec:
replicas: 1
selector:
matchLabels:
app: logstash
template:
metadata:
labels:
app: logstash
spec:
containers:
- name: logstash
image: docker.elastic.co/logstash/logstash:7.16.3
ports:
- containerPort: 5044
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 1
memory: 1Gi
volumeMounts:
- name: config
mountPath: /usr/share/logstash/pipeline/logstash.conf
subPath: logstash.conf
readOnly: true
volumes:
- name: config
configMap:
name: logstash-config
items:
- key: logstash.conf
path: logstash.conf
---
apiVersion: v1
kind: Service
metadata:
name: logstash
labels:
app: logstash
spec:
ports:
- port: 5044
targetPort: 5044
selector:
app: logstash
type: ClusterIP