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.name: kibana
server.host: 0.0.0.0 server.host: 0.0.0.0
elasticsearch.hosts: [ "http://elastic:9200" ] 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 apiVersion: apps/v1
kind: Deployment kind: Deployment
@ -42,11 +28,8 @@ spec:
containers: containers:
- name: kibana - name: kibana
image: docker.elastic.co/kibana/kibana:7.16.3 image: docker.elastic.co/kibana/kibana:7.16.3
volumeMounts: ports:
- name: config - containerPort: 5601
mountPath: /usr/share/kibana/config/kibana.yml
subPath: kibana.yml
readOnly: true
resources: resources:
requests: requests:
cpu: 100m cpu: 100m
@ -54,8 +37,11 @@ spec:
limits: limits:
cpu: 1 cpu: 1
memory: 1Gi memory: 1Gi
ports: volumeMounts:
- containerPort: 5601 - name: config
mountPath: /usr/share/kibana/config/kibana.yml
subPath: kibana.yml
readOnly: true
volumes: volumes:
- name: config - name: config
configMap: configMap:
@ -63,3 +49,19 @@ spec:
items: items:
- key: kibana.yml - 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