// This assembly is included in the following assemblies:
//
// assembly-customizing-deployments.adoc

[id='con-customizing-external-services-{context}']
= Customizing external Services

When exposing Kafka outside of Kubernetes using loadbalancers or node ports, you can use additional customization properties in addition to labels and annotations.
The properties for external services are described in the following table and affect how a Service is created.

[table,stripes=none]
|===
|Field |Description

|`externalTrafficPolicy`
|Specifies whether the service routes external traffic to node-local or cluster-wide endpoints.
`Cluster` may cause a second hop to another node and obscures the client source IP.
`Local` avoids a second hop for LoadBalancer and Nodeport type services and preserves the client source IP (when supported by the infrastructure).
If unspecified, Kubernetes will use `Cluster` as the default.

|`loadBalancerSourceRanges`
|A list of CIDR ranges (for example `10.0.0.0/8` or `130.211.204.1/32`) from which clients can connect to load balancer type listeners.
If supported by the platform, traffic through the loadbalancer is restricted to the specified CIDR ranges.
This field is applicable only for loadbalancer type services, and is ignored if the cloud provider does not support the feature.

For more information, see https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/.
|===

These properties are available for `externalBootstrapService` and `perPodService`.
The following example shows these customized properties for a `template`:

[source,yaml,subs=attributes+]
----
# ...
template:
  externalBootstrapService:
    externalTrafficPolicy: Local
    loadBalancerSourceRanges:
      - 10.0.0.0/8
      - 88.208.76.87/32
  perPodService:
    externalTrafficPolicy: Local
    loadBalancerSourceRanges:
      - 10.0.0.0/8
      - 88.208.76.87/32
# ...
----

.Additional resources

* For more information, see xref:type-ExternalServiceTemplate-reference[].
