--- title: Kubernetes description: A template that is used to control the production of Kubernetes-specific attributes. location: https://istio.io/docs/reference/config/policy-and-telemetry/templates/kubernetes.html layout: protoc-gen-docs generator: protoc-gen-docs number_of_entries: 3 ---
The kubernetes
template holds data that controls the production of Kubernetes-specific
attributes.
Example config:
apiVersion: "config.istio.io/v1alpha2"
kind: kubernetes
metadata:
name: attributes
namespace: istio-system
spec:
# Pass the required attribute data to the adapter
source_uid: source.uid | ""
source_ip: source.ip | ip("0.0.0.0") # default to unspecified ip addr
destination_uid: destination.uid | ""
destination_ip: destination.ip | ip("0.0.0.0") # default to unspecified ip addr
attribute_bindings:
# Fill the new attributes from the adapter produced output.
# $out refers to an instance of OutputTemplate message
source.ip: $out.source_pod_ip
source.labels: $out.source_labels
source.namespace: $out.source_namespace
source.service: $out.source_service
source.serviceAccount: $out.source_service_account_name
destination.ip: $out.destination_pod_ip
destination.labels: $out.destination_labels
destination.namespace: $out.destination_mamespace
destination.service: $out.destination_service
destination.serviceAccount: $out.destination_service_account_name
OutputTemplate refers to the output from the adapter. It is used inside the attribute_binding section of the config
to assign values to the generated attributes using the $out.<field name of the OutputTemplate>
syntax.
The kubernetes
template represents data used to generate kubernetes-derived attributes.
The values provided controls the manner in which the kubernetesenv adapter discovers and generates values related to pod information.
An instance field of type IPAddress denotes that the expression for the field must evalaute to ValueType.IP_ADDRESS
Objects of type IPAddress are also passed to the adapters during request-time for the instance fields of type IPAddress