k8sobserver

package module
v0.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2021 License: Apache-2.0 Imports: 13 Imported by: 4

README

Kubernetes Observer

The k8sobserver uses the Kubernetes API to discover pods running on the local node. This assumes the collector is deployed in the "agent" model where it is running on each individual node/host instance.

Config

auth_type

How to authenticate to the K8s API server. This can be one of none (for no auth), serviceAccount (to use the standard service account token provided to the agent pod), or kubeConfig to use credentials from ~/.kube/config.

node

Node should be set to the node name to limit discovered endpoints to. For example, node name can be set using the downward API inside the collector pod spec as follows:

env:
  - name: K8S_NODE_NAME
    valueFrom:
      fieldRef:
        fieldPath: spec.nodeName

Then set this value to ${K8S_NODE_NAME} in the configuration.

The full list of settings exposed for this exporter are documented here with detailed sample configurations here.

Documentation

Overview

Package k8sobserver implements a k8s observer extension for monitoring pods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() component.ExtensionFactory

NewFactory should be called to create a factory with default values.

Types

type Config

type Config struct {
	config.ExtensionSettings `mapstructure:",squash"`
	k8sconfig.APIConfig      `mapstructure:",squash"`

	// Node should be set to the node name to limit discovered endpoints to. For example, node name can
	// be set using the downward API inside the collector pod spec as follows:
	//
	// env:
	//   - name: K8S_NODE_NAME
	//     valueFrom:
	//       fieldRef:
	//         fieldPath: spec.nodeName
	//
	// Then set this value to ${K8S_NODE_NAME} in the configuration.
	Node string `mapstructure:"node"`
}

Config defines configuration for k8s attributes processor.

func (*Config) Validate added in v0.25.0

func (cfg *Config) Validate() error

Validate checks if the extension configuration is valid

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory is the factory for the extension.

func NewFactoryWithConfig

func NewFactoryWithConfig(config *rest.Config) *Factory

NewFactoryWithConfig creates a k8s observer factory with the given k8s API config.

func (*Factory) CreateDefaultConfig

func (f *Factory) CreateDefaultConfig() config.Extension

CreateDefaultConfig creates the default configuration for the extension.

func (*Factory) CreateExtension

func (f *Factory) CreateExtension(
	ctx context.Context,
	params component.ExtensionCreateSettings,
	cfg config.Extension,
) (component.Extension, error)

CreateExtension creates the extension based on this config.

func (*Factory) Type

func (f *Factory) Type() config.Type

Type gets the type of the config created by this factory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL