我的集群在 AWS 上,并且我使用 kops 来构建集群。
我正在尝试使用 fluentd 将 kubernetes 日志发送到 AWS Cloud-watch。我能够启动 fluentd pod。
我从 pod 的日志中看到以下错误。我已为 pod 创建了必要的策略,以假设将日志发送到 Cloud Watch 日志中的日志组。
2018-10-23 18:16:03 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2018-10-23 18:15:59 +0000 error_class="Aws::Errors::MissingCredentialsError" error="unable to sign
request without credentials set" plugin_id="object:2b07171c9ce4"
018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/signature_v4.rb:72:in `sign_request'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/signature_v4.rb:112:in `apply_signature'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/signature_v4.rb:65:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/helpful_socket_errors.rb:10:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/retry_errors.rb:138:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/json/handler.rb:11:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/user_agent.rb:13:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/seahorse/client/plugins/endpoint.rb:45:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/param_validator.rb:24:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/seahorse/client/plugins/raise_response_errors.rb:14:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/idempotency_token.rb:17:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/param_converter.rb:24:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/seahorse/client/plugins/response_target.rb:23:in `call'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-core-3.22.1/lib/seahorse/client/request.rb:70:in `send_request'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/aws-sdk-cloudwatchlogs-1.4.0/lib/aws-sdk-cloudwatchlogs/client.rb:736:in `describe_log_groups'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/fluent-plugin-cloudwatch-logs-0.4.5/lib/fluent/plugin/out_cloudwatch_logs.rb:403:in `log_group_exists?'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/fluent-plugin-cloudwatch-logs-0.4.5/lib/fluent/plugin/out_cloudwatch_logs.rb:152:in `block in write'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/fluent-plugin-cloudwatch-logs-0.4.5/lib/fluent/plugin/out_cloudwatch_logs.rb:144:in `each'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/fluent-plugin-cloudwatch-logs-0.4.5/lib/fluent/plugin/out_cloudwatch_logs.rb:144:in `write'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/fluentd-0.12.43/lib/fluent/buffer.rb:354:in `write_chunk'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/fluentd-0.12.43/lib/fluent/buffer.rb:333:in `pop'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/fluentd-0.12.43/lib/fluent/output.rb:342:in `try_flush'
2018-10-23 18:16:04 +0000 [warn]: /fluentd/vendor/bundle/ruby/2.4.0/gems/fluentd-0.12.43/lib/fluent/output.rb:149:in `run'
2018-10-23 18:16:07 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2018-10-23 18:16:01 +0000 error_class="Aws::Errors::MissingCredentialsError" error="unable to sign
request without credentials set" plugin_id="object:2b07171c9ce4"
2018-10-23 18:16:07 +0000 [warn]: suppressed same stacktrace
答案1
我安装了 kube2iam 并解决了这个问题。