Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/build_and_push_to_dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e
echo "Building docker image..."
cp /tmp/pkg/fluent-plugin-kubernetes-metrics-*.gem docker
VERSION=`cat VERSION`
docker build --build-arg VERSION=$VERSION --no-cache -t splunk/fluent-plugin-kubernetes-metrics:ci ./docker
docker build --build-arg VERSION=$FLUENT_SPLUNK_HEC_GEM_VERSION --no-cache -t splunk/fluent-plugin-kubernetes-metrics:ci ./docker
docker tag splunk/fluent-plugin-kubernetes-metrics:ci splunk/${DOCKERHUB_REPO_NAME}:${VERSION}
echo "Push docker image to splunk dockerhub..."
docker login --username=$DOCKERHUB_ACCOUNT_ID --password=$DOCKERHUB_ACCOUNT_PASS
Expand Down
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Report a bug encountered while operating fluent-plugin-kubernetes-metrics
title: ''
labels: ''
assignees: ''

---

<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!

Please do not report security vulnerabilities with public GitHub issue reports. Please report security issues here: https://www.splunk.com/goto/report_vulnerabilities_prodsec
-->


**What happened**:

**What you expected to happen**:

**How to reproduce it (as minimally and precisely as possible)**:

**Anything else we need to know?**:

**Environment**:
- Kubernetes version (use `kubectl version`):
- Ruby version (use `ruby --version`):
- OS (e.g: `cat /etc/os-release`):
- Splunk version:
- Others:
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Enhancement Request
about: Suggest an enhancement to the fluent-plugin-kubernetes-metrics project
title: ''
labels: ''
assignees: ''

---

<<!-- Please only use this template for submitting enhancement requests -->

**What would you like to be added**:

**Why is this needed**:
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/failing_test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Failing Test
about: Report test failures in fluent-plugin-kubernetes-metrics
title: ''
labels: ''
assignees: ''

---

<!-- Please only use this template for submitting reports about failing tests -->

**Which test(s) are failing**:

**Since when has it been failing**:

**Reason for failure**:

**Anything else we need to know**:
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Proposed changes

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

## Types of changes

What types of changes does your code introduce?
_Put an `x` in the boxes that apply_

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist

_Put an `x` in the boxes that apply._

- [ ] I have read the [CONTRIBUTING](https://github.com/splunk/fluent-plugin-kubernetes-metrics/blob/develop/CONTRIBUTING.md) doc
- [ ] I have read the [CLA](https://github.com/splunk/fluent-plugin-kubernetes-metrics/blob/develop/CLA.md)
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)
- [ ] Any dependent changes have been merged and published in downstream modules

18 changes: 18 additions & 0 deletions CLA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
By submitting a Contribution to this Work, You agree that Your Contribution is made subject to the primary LICENSE
file applicable to this Work. In addition, You represent that: (i) You are the copyright owner of the Contribution
or (ii) You have the requisite rights to make the Contribution.

Definitions:

“You” shall mean: (i) yourself if you are making a Contribution on your own behalf; or (ii) your company,
if you are making a Contribution on behalf of your company. If you are making a Contribution on behalf of your
company, you represent that you have the requisite authority to do so.

"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing
work, that is intentionally submitted by You for inclusion in, or documentation of, this project/repository. For the
purposes of this definition, "submitted" means any form of electronic, verbal, or written communication submitted for
inclusion in this project/repository, including but not limited to communication on electronic mailing lists, source
code control systems, and issue tracking systems that are managed by, or on behalf of, the maintainers of
the project/repository.

“Work” shall mean the collective software, content, and documentation in this project/repository.
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PATH
remote: .
specs:
fluent-plugin-kubernetes-metrics (1.1.0.Alpha)
fluentd (~> 1.3.3)
fluent-plugin-kubernetes-metrics (1.1.0)
fluentd (~> 1.4.0)
kubeclient (~> 4.2.2)
multi_json (~> 1.13.1)
oj (~> 3.7.8)
oj (~> 3.7.9)

GEM
remote: https://rubygems.org/
Expand All @@ -19,7 +19,7 @@ GEM
docile (1.3.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
fluentd (1.3.3)
fluentd (1.4.0)
cool.io (>= 1.4.5, < 2.0.0)
dig_rb (~> 1.0.0)
http_parser.rb (>= 0.5.1, < 0.7.0)
Expand Down Expand Up @@ -48,10 +48,10 @@ GEM
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
msgpack (1.2.6)
msgpack (1.2.7)
multi_json (1.13.1)
netrc (0.11.0)
oj (3.7.8)
oj (3.7.9)
power_assert (1.1.3)
public_suffix (3.0.3)
rake (12.3.2)
Expand Down Expand Up @@ -90,7 +90,7 @@ PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.0.1)
bundler (~> 2.0.0)
fluent-plugin-kubernetes-metrics!
rake (~> 12.3.2)
simplecov (~> 0.16.1)
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[![CircleCI](https://circleci.com/gh/git-lfs/git-lfs.svg?style=shield&circle-token=856152c2b02bfd236f54d21e1f581f3e4ebf47ad)](https://circleci.com/gh/splunk/fluent-plugin-kubernetes-metrics)
# Fluentd Plugin for Kubernetes Metrics

The [Fluentd](https://fluentd.org/) input plugin collects kubernetes cluster metrics which are exposed by the [Kubelet API](https://kubernetes.io/docs/admin/kubelet/) and forwards them to fluentd.
The [Fluentd](https://fluentd.org/) input plugin collects Kubernetes cluster metrics which are exposed by the [Kubelet API](https://kubernetes.io/docs/admin/kubelet/) and forwards them to fluentd.
The plugin collects metrics from:
* The kubelet summary API
* The kubelet stats API
* The cAdvisor metrics API

The Fluentd input plugin can be configured to fetch metrics from either the Kublernetes API server or from the Kubelet itself.
The Fluentd input plugin can be configured to fetch metrics from the Kubernetes API server or from the Kubelet.
For more details on the specific metrics that are collected and aggregated with this plugin, please refer to the
[metrics information](https://github.com/splunk/fluent-plugin-kubernetes-metrics/blob/master/metrics-information.md) document.

## Installation

Expand Down Expand Up @@ -95,9 +97,15 @@ The name of the node from which the plugin should collect metrics. This enables

Array of the nodes from which the this plugin should collect metrics. This enables the plugin to fetch metrics from kubeapiserver. Used only when use_rest_client configuration parameter is not enabled.

### kubelet_address (string) (optional)

The hostname or IP address that kubelet will use to connect to. If not supplied, status.hostIP of the node is used to fetch metrics from the Kubelet API (via the $KUBERNETES_NODE_IP environment variable).

Default value: `"#{ENV['KUBERNETES_NODE_IP']}"`.

### kubelet_port (integer) (optional)

The port that kubelet is listening to.
The port that kubelet is listening on.

Default value: `10250`.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.1.1
6 changes: 3 additions & 3 deletions fluent-plugin-kubernetes-metrics.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Gem::Specification.new do |spec|
spec.executables = files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = test_files
spec.require_paths = ['lib']
spec.add_development_dependency 'bundler', '~> 2.0.1'
spec.add_development_dependency 'bundler', '~> 2.0.0'
spec.add_development_dependency 'rake', '~> 12.3.2'
spec.add_development_dependency 'simplecov', '~> 0.16.1'
spec.add_development_dependency 'test-unit', '~> 3.3.0'
spec.add_development_dependency 'webmock', '~> 3.5.1'
spec.add_runtime_dependency 'fluentd', '~> 1.3.3'
spec.add_runtime_dependency 'fluentd', '~> 1.4.0'
spec.add_runtime_dependency 'kubeclient', '~> 4.2.2'
spec.add_runtime_dependency 'multi_json', '~> 1.13.1'
spec.add_runtime_dependency 'oj', '~> 3.7.8'
spec.add_runtime_dependency 'oj', '~> 3.7.9'
end
5 changes: 4 additions & 1 deletion lib/fluent/plugin/in_kubernetes_metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class KubernetesMetricsInput < Fluent::Plugin::Input
desc 'Name of the nodes that this plugin should collect metrics from.'
config_param :node_names, :array, default: [], value_type: :string

desc 'The hostname or IP address that kubelet will use to connect to. If not supplied, status.hostIP of the node is used to fetch metrics from the Kubelet API (via the $KUBERNETES_NODE_IP environment variable)'
config_param :kubelet_address, :string, default: "#{ENV['KUBERNETES_NODE_IP']}"

desc 'The port that kubelet is listening to.'
config_param :kubelet_port, :integer, default: 10_250

Expand Down Expand Up @@ -193,7 +196,7 @@ def initialize_client
end

def initialize_rest_client
env_host = @node_name
env_host = @kubelet_address
env_port = @kubelet_port

if env_host && env_port
Expand Down
Loading