Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Latest commit

 

History

History
86 lines (65 loc) · 5.74 KB

k8s-kubelet.md

File metadata and controls

86 lines (65 loc) · 5.74 KB

k8s-kubelet

DEPRECATED Discovers service endpoints running on the same node as the agent by querying the local kubelet instance. It is generally recommended to use the k8s-api observer because authentication to the local kubelet can be more difficult to setup, and also the kubelet API is technically not documented for public consumption, so this observer may break more easily in future K8s versions.

Observer Type: k8s-kubelet

Observer Source Code

Configuration

Config option Required Type Description
pollIntervalSeconds no integer How often to poll the Kubelet instance for pod information (default: 10)
kubeletAPI no object (see below) Config for the Kubelet HTTP client

The nested kubeletAPI config object has the following fields:

Config option Required Type Description
url no string URL of the Kubelet instance. This will default to http://<current node hostname>:10255 if not provided.
authType no string Can be none for no auth, tls for TLS client cert auth, or serviceAccount to use the pod's default service account token to authenticate. (default: none)
skipVerify no bool Whether to skip verification of the Kubelet's TLS cert (default: true)
caCertPath no string Path to the CA cert that has signed the Kubelet's TLS cert, unnecessary if skipVerify is set to false.
clientCertPath no string Path to the client TLS cert to use if authType is set to tls
clientKeyPath no string Path to the client TLS key to use if authType is set to tls
logResponses no bool Whether to log the raw cadvisor response at the debug level for debugging purposes. (default: false)

Target Variables

The following fields are available on targets generated by this observer and can be used in discovery rules.

Name Type Description
container_name string The first and primary name of the container as it is known to the container runtime (e.g. Docker).
has_port string Set to true if the endpoint has a port assigned to it. This will be false for endpoints that represent a host/container as a whole.
ip_address string The IP address of the endpoint if the host is in the from of an IPv4 address
network_port string An alias for port
private_port string The port that the service endpoint runs on inside the container
public_port string The port exposed outside the container
alternate_port integer Used for services that are accessed through some kind of NAT redirection as Docker does. This could be either the public port or the private one.
container_command string The command used when running the container exposing the endpoint
container_id string The ID of the container exposing the endpoint
container_image string The image name of the container exposing the endpoint
container_labels map of string A map that contains container label key/value pairs. You can use the Contains and Get helper functions in discovery rules to make use of this. See Endpoint Discovery. For containers managed by Kubernetes, this will be set to the pod's labels, as individual containers do not have labels in Kubernetes proper.
container_names list of string A list of container names of the container exposing the endpoint
container_state string The container state, will usually be "running" since otherwise the container wouldn't have a port exposed to be discovered.
discovered_by string The observer that discovered this endpoint
host string The hostname/IP address of the endpoint. If this is an IPv6 address, it will be surrounded by [ and ].
id string
name string A observer assigned name of the endpoint. For example, if using the k8s-api observer, name will be the port name in the pod spec, if any.
orchestrator integer
port integer The TCP/UDP port number of the endpoint
port_labels map of string A map of labels on the container port
port_type string TCP or UDP
target string The type of the thing that this endpoint directly refers to. If the endpoint has a host and port associated with it (most common), the value will be hostport. Other possible values are: pod, container, host. See the docs for the specific observer you are using for more details on what types that observer emits.

Dimensions

These dimensions are added to all metrics that are emitted for this discovery target. These variables are also available to use as variables in discovery rules.

Name Description
container_id The container id of the container running this endpoint.
container_image The image name (including tags) of the running container
container_name The primary name of the running container -- Docker containers can have multiple names but this will be the first name, if any.
container_spec_name The short name of the container in the pod spec, NOT the running container's name in the Docker engine
kubernetes_namespace The namespace that the discovered service endpoint is running in.
kubernetes_pod_name The name of the running pod that is exposing the discovered endpoint
kubernetes_pod_uid The UID of the pod that is exposing the discovered endpoint