istio.io/content/docs/reference/config/policy-and-telemetry/templates/kubernetes/index.html

304 lines
10 KiB
HTML

---
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: 2
---
<p>The <code>kubernetes</code> template holds data that controls the production of Kubernetes-specific
attributes.</p>
<p>Example config:</p>
<pre><code class="language-yaml">apiVersion: &quot;config.istio.io/v1alpha2&quot;
kind: kubernetes
metadata:
name: attributes
namespace: istio-system
spec:
# Pass the required attribute data to the adapter
source_uid: source.uid | &quot;&quot;
source_ip: source.ip | ip(&quot;0.0.0.0&quot;) # default to unspecified ip addr
destination_uid: destination.uid | &quot;&quot;
destination_ip: destination.ip | ip(&quot;0.0.0.0&quot;) # 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
</code></pre>
<h2 id="OutputTemplate">OutputTemplate</h2>
<section>
<p>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 <code>$out.&lt;field name of the OutputTemplate&gt;</code> syntax.
Next ID: 33</p>
<table class="message-fields">
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr id="OutputTemplate-source_pod_uid">
<td><code>sourcePodUid</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the source.uid for a pod. This is for TCP use cases where the attribute is not present.
attribute<em>bindings can refer to this field using $out.source</em>pod_uid</p>
</td>
</tr>
<tr id="OutputTemplate-source_pod_ip">
<td><code>sourcePodIp</code></td>
<td><code><a href="/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1.html#IPAddress">istio.policy.v1beta1.IPAddress</a></code></td>
<td>
<p>Refers to source pod ip address. attribute<em>bindings can refer to this field using $out.source</em>pod_ip</p>
</td>
</tr>
<tr id="OutputTemplate-source_pod_name">
<td><code>sourcePodName</code></td>
<td><code>string</code></td>
<td>
<p>Refers to source pod name. attribute<em>bindings can refer to this field using $out.source</em>pod_name</p>
</td>
</tr>
<tr id="OutputTemplate-source_labels">
<td><code>sourceLabels</code></td>
<td><code>map&lt;string,&nbsp;string&gt;</code></td>
<td>
<p>Refers to source pod labels. attribute<em>bindings can refer to this field using $out.source</em>labels</p>
</td>
</tr>
<tr id="OutputTemplate-source_namespace">
<td><code>sourceNamespace</code></td>
<td><code>string</code></td>
<td>
<p>Refers to source pod namespace. attribute<em>bindings can refer to this field using $out.source</em>namespace</p>
</td>
</tr>
<tr id="OutputTemplate-source_service_account_name">
<td><code>sourceServiceAccountName</code></td>
<td><code>string</code></td>
<td>
<p>Refers to source pod service account name. attribute<em>bindings can refer to this field using $out.source</em>service<em>account</em>name</p>
</td>
</tr>
<tr id="OutputTemplate-source_host_ip">
<td><code>sourceHostIp</code></td>
<td><code><a href="/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1.html#IPAddress">istio.policy.v1beta1.IPAddress</a></code></td>
<td>
<p>Refers to source pod host ip address. attribute<em>bindings can refer to this field using $out.source</em>host_ip</p>
</td>
</tr>
<tr id="OutputTemplate-source_workload_uid">
<td><code>sourceWorkloadUid</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the Istio workload identifier for the source pod. Attribute<em>bindings can refer to this field using $out.source</em>workload_uid</p>
</td>
</tr>
<tr id="OutputTemplate-source_workload_name">
<td><code>sourceWorkloadName</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the Istio workload name for the source pod. Attribute<em>bindings can refer to this field using $out.source</em>workload_name</p>
</td>
</tr>
<tr id="OutputTemplate-source_workload_namespace">
<td><code>sourceWorkloadNamespace</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the Istio workload namespace for the source pod. Attribute<em>bindings can refer to this field using $out.source</em>workload_namespace</p>
</td>
</tr>
<tr id="OutputTemplate-source_owner">
<td><code>sourceOwner</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the (controlling) owner of the source pod. Attribute<em>bindings can refer to this field using $out.source</em>owner</p>
</td>
</tr>
<tr id="OutputTemplate-destination_pod_uid">
<td><code>destinationPodUid</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the destination.uid for a pod. This is for TCP use cases where the attribute is not present.
attribute<em>bindings can refer to this field using $out.destination</em>pod_uid</p>
</td>
</tr>
<tr id="OutputTemplate-destination_pod_ip">
<td><code>destinationPodIp</code></td>
<td><code><a href="/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1.html#IPAddress">istio.policy.v1beta1.IPAddress</a></code></td>
<td>
<p>Refers to destination pod ip address. attribute<em>bindings can refer to this field using $out.destination</em>pod_ip</p>
</td>
</tr>
<tr id="OutputTemplate-destination_pod_name">
<td><code>destinationPodName</code></td>
<td><code>string</code></td>
<td>
<p>Refers to destination pod name. attribute<em>bindings can refer to this field using $out.destination</em>pod_name</p>
</td>
</tr>
<tr id="OutputTemplate-destination_container_name">
<td><code>destinationContainerName</code></td>
<td><code>string</code></td>
<td>
<p>Refers to destination container name. attribute<em>bindings can refer to this field using $out.destination</em>container_name</p>
</td>
</tr>
<tr id="OutputTemplate-destination_labels">
<td><code>destinationLabels</code></td>
<td><code>map&lt;string,&nbsp;string&gt;</code></td>
<td>
<p>Refers to destination pod labels. attribute<em>bindings can refer to this field using $out.destination</em>labels</p>
</td>
</tr>
<tr id="OutputTemplate-destination_namespace">
<td><code>destinationNamespace</code></td>
<td><code>string</code></td>
<td>
<p>Refers to destination pod namespace. attribute<em>bindings can refer to this field using $out.destination</em>namespace</p>
</td>
</tr>
<tr id="OutputTemplate-destination_service_account_name">
<td><code>destinationServiceAccountName</code></td>
<td><code>string</code></td>
<td>
<p>Refers to destination pod service account name. attribute<em>bindings can refer to this field using $out.destination</em>service<em>account</em>name</p>
</td>
</tr>
<tr id="OutputTemplate-destination_host_ip">
<td><code>destinationHostIp</code></td>
<td><code><a href="/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1.html#IPAddress">istio.policy.v1beta1.IPAddress</a></code></td>
<td>
<p>Refers to destination pod host ip address. attribute<em>bindings can refer to this field using $out.destination</em>host_ip</p>
</td>
</tr>
<tr id="OutputTemplate-destination_owner">
<td><code>destinationOwner</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the (controlling) owner of the destination pod. Attribute<em>bindings can refer to this field using $out.destination</em>owner</p>
</td>
</tr>
<tr id="OutputTemplate-destination_workload_uid">
<td><code>destinationWorkloadUid</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the Istio workload identifier for the destination pod. Attribute<em>bindings can refer to this field using $out.destination</em>workload_uid</p>
</td>
</tr>
<tr id="OutputTemplate-destination_workload_name">
<td><code>destinationWorkloadName</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the Istio workload name for the destination pod. Attribute<em>bindings can refer to this field using $out.destination</em>workload_name</p>
</td>
</tr>
<tr id="OutputTemplate-destination_workload_namespace">
<td><code>destinationWorkloadNamespace</code></td>
<td><code>string</code></td>
<td>
<p>Refers to the Istio workload name for the destination pod. Attribute<em>bindings can refer to this field using $out.destination</em>workload_namespace</p>
</td>
</tr>
</tbody>
</table>
</section>
<h2 id="Template">Template</h2>
<section>
<p>The <code>kubernetes</code> template represents data used to generate kubernetes-derived attributes.</p>
<p>The values provided controls the manner in which the kubernetesenv adapter discovers and
generates values related to pod information.
Next ID: 8</p>
<table class="message-fields">
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr id="Template-source_uid">
<td><code>sourceUid</code></td>
<td><code>string</code></td>
<td>
<p>Source pod&rsquo;s uid. Must be of the form: &ldquo;kubernetes://pod.namespace&rdquo;</p>
</td>
</tr>
<tr id="Template-source_ip">
<td><code>sourceIp</code></td>
<td><code><a href="/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1.html#IPAddress">istio.policy.v1beta1.IPAddress</a></code></td>
<td>
<p>Source pod&rsquo;s ip.</p>
</td>
</tr>
<tr id="Template-destination_uid">
<td><code>destinationUid</code></td>
<td><code>string</code></td>
<td>
<p>Destination pod&rsquo;s uid. Must be of the form: &ldquo;kubernetes://pod.namespace&rdquo;</p>
</td>
</tr>
<tr id="Template-destination_ip">
<td><code>destinationIp</code></td>
<td><code><a href="/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1.html#IPAddress">istio.policy.v1beta1.IPAddress</a></code></td>
<td>
<p>Destination pod&rsquo;s ip.</p>
</td>
</tr>
<tr id="Template-destination_port">
<td><code>destinationPort</code></td>
<td><code>int64</code></td>
<td>
<p>Destination container&rsquo;s port number.</p>
</td>
</tr>
</tbody>
</table>
</section>