Kubernetes Dynamic Cluster Name
OpenTelemetry publishes semantic conventions for common resources. The OpenTelemetry Kubernetes Semantic Conventions can be found here.
Bindplane detects most of the resource attributes when using the Kubernetes sources. Bindplane does
not detect the cluster name (k8s.cluster.name
) because Kubernetes does not have the concept of a
name. It is crucial to set k8s.cluster.name
to filter between multiple clusters in your environment.
Bindplane has three methods for setting the k8s.cluster.name
resource attribute.
- Static configuration value
- Environment variable
- Resource Detection
Static Cluster Name
Bindplane's Kubernetes source types require the user to input a static cluster name. This is the easiest way to set the cluster name.
See the source type documentation for details:
Using a static cluster name will mean that you need one configuration per Kubernetes cluster. This solution is simple, but will not scale well in large environments. If you wish to use a single collector configuration for many clusters, see the Environment Variable and Resource Detection sections.
Environment Variable
Bindplane can use the Add Fields Processor
to update the k8s.cluster.name
resource attribute to the value of an environment variable.
Use a placeholder cluster in your configuration's source(s).
Next, use the Add Fields Processor
to upsert the resource attribute k8s.cluster.name
with the value of the environment variable
CLUSTER_NAME
.
Follow the collector installation workflow to retrieve the Kubernetes YAML manifest for the collector.
Add an environment variable to the YAML manifest. The value should be the name of your cluster. If you have multiple clusters, make sure to copy the YAML manifest, once per cluster.
Deploy the collector configuration to your cluster.
Once the collectors are deployed, pick one of them and view its recent telemetry. You should see the cluster name defined in the collector's environment instead of the placeholder name.
note
Be sure to configure the Add Fields processor on the configuration that matches the collector you have deployed.
Resource Detection
Bindplane can use the Resource Detection Processor to detect the cluster name by making an API request to your cloud provider.
Currently, only Google Cloud's GKE is supported. Support for Amazon EKS and Azure AKS is coming soon.
See the Resource Detection Kubernetes section for configuration details.
Frequently Asked Questions
Q: Can I set the cluster name using a Gateway collector?
A: Yes. If you are forwarding telemetry from the Node and Cluster collectors to a Gateway collector, you can configure the Add Fields or Resource Detection processor on the Gateway configuration.