Я бегло бегу в свой кластер k8s (k3d).
Я установил fluent-plugin-input-gelf-0.3.1
, с этой конфигурацией:
<source>
@type gelf
tag "example.gelf"
bind "0.0.0.0"
port 12201
</source>
Это журналы:
[info]: #0 starting fluentd worker pid=17 ppid=8 worker=0
[info]: #0 listening gelf socket on 0.0.0.0:12201 with udp
[info]: #0 listening port port=24224 bind="0.0.0.0"
[info]: #0 fluentd worker is now running worker=0
Как видите, gelf input plugin
прослушивает в порту 12201 with udp
.
Также manager
прослушивает 24224
.
Это мои услуги:
$ kubectl describe service -l app=fluentd
Name: fluentd-1582814293
Namespace: logging
Labels: app=fluentd
chart=fluentd-2.3.2
heritage=Helm
release=fluentd-1582814293
Annotations: <none>
Selector: app=fluentd,release=fluentd-1582814293
Type: ClusterIP
IP: 10.43.205.18
Port: monitor-agent 24220/TCP
TargetPort: 24220/TCP
Endpoints: 10.42.1.13:24220
Port: gelf 12201/UDP
TargetPort: 12201/UDP
Endpoints: 10.42.1.13:12201
Session Affinity: None
Events: <none>
И вот мой вход:
$ kubectl describe ingresses.networking.k8s.io fluentd-1582814293
Name: fluentd-1582814293
Namespace: logging
Address: 172.18.0.4
Default backend: default-http-backend:80 (<none>)
Rules:
Host Path Backends
---- ---- --------
monitor.fluentd.localhost
/ fluentd-1582814293:24220 (10.42.1.13:24220)
gelf.fluentd.localhost
/ fluentd-1582814293:12201 (10.42.1.13:12201)
Annotations:
Events: <none>
Мне удалось получить что-то от monitor-agent
:
$ curl http://monitor.fluentd.localhost/api/plugins.json | jq
{
"plugins": [
{
"plugin_id": "object:3f92319dde80",
"plugin_category": "input",
"type": "forward",
"config": {
"@type": "forward",
"port": "24224",
"bind": "0.0.0.0"
},
"output_plugin": false,
"retry_count": null
},
{
"plugin_id": "object:3f9231206ab8",
"plugin_category": "input",
"type": "gelf",
"config": {
"@type": "gelf",
"tag": "example.gelf",
"bind": "0.0.0.0",
"port": "12201"
},
"output_plugin": false,
"retry_count": null
},
{
"plugin_id": "object:3f9231257a94",
"plugin_category": "input",
"type": "http",
"config": {
"@type": "http",
"port": "9880",
"bind": "0.0.0.0"
},
"output_plugin": false,
"retry_count": null
},
{
"plugin_id": "object:3f92312b15e4",
"plugin_category": "input",
"type": "monitor_agent",
"config": {
"@type": "monitor_agent",
"bind": "0.0.0.0",
"port": "24220",
"tag": "fluentd.monitor.metrics"
},
"output_plugin": false,
"retry_count": null
},
{
"plugin_id": "object:3f923428453c",
"plugin_category": "output",
"type": "null",
"config": {
"@type": "null"
},
"output_plugin": true,
"retry_count": 0,
"retry": {}
},
{
"plugin_id": "object:3f92348c5964",
"plugin_category": "output",
"type": "null",
"config": {
"@type": "null"
},
"output_plugin": true,
"retry_count": 0,
"retry": {}
},
{
"plugin_id": "elasticsearch",
"plugin_category": "output",
"type": "elasticsearch",
"config": {
"@id": "elasticsearch",
"@type": "elasticsearch",
"@log_level": "info",
"include_tag_key": "true",
"host": "elasticsearch-master",
"port": "9200",
"scheme": "http",
"ssl_version": "TLSv1",
"logstash_format": "true"
},
"output_plugin": true,
"buffer_queue_length": 0,
"buffer_total_queued_size": 0,
"retry_count": 0,
"retry": {}
}
]
}
Однако я не в состоянии общаться с gelf source input plugin
. Это вывод моей службы пытается связаться с свободно:
Listening for transport dt_socket at address: 5005
INFO [io.quarkus] (main) Quarkus 1.1.0.Final started in 1.798s. Listening on: http://0.0.0.0:8080
INFO [io.quarkus] (main) Profile dev activated. Live Coding activated.
LogManager error of type GENERIC_FAILURE: Port gelf.fluentd.localhost:80 not reachable
Я проверил это с помощью fluent-cat
cli внутри fluentd
модуль:
$ kubectl exec fluentd-1582814293-5f8dcccc5c-lvv9p -ti sh
# echo '{"message":"hello"}' | fluent-cat example.gelf
Он глотается и перенаправил правильно ...
Однако, когда я пытаюсь:
$ kubectl exec fluentd-1582814293-5f8dcccc5c-lvv9p -ti sh
echo '{"message":"hello"}' | fluent-cat --port 12201 debug.log
connect failed: Connection refused - connect(2) for "127.0.0.1" port 12201
Есть идеи?