Using own cookie (application generated) for consistent hash load balancing

Hello,
I understand that for consistent hash based load balancing to a service we can configured using an HTTP cookie which can generated by configuring it in the DestinationRule (Istio / Destination Rule).

apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: sticky-rule
  namespace: my-ns
spec:
  host: app-svc.my-ns.svc.cluster.local
  trafficPolicy:
    loadBalancer:
      consistentHash:
        httpCookie:
          name: STICKY-SESSION-COOKIE
          path: /
          ttl: 0s

I would like to clarify what happens if the cookie name provided in the DestinationRule already exists:

  • If the cookie (STICKY-SESSION-COOKIE) is set by the application (behind the service), I see that the cookie is not overwritten/generated by istio. Does the sticky routing also work with own (application) cookie
  • In this case, where is the mapping to the cookie value and the backend hosts maintained? If it is within envoy (istio-proxy) of individual pods, are there redirects between the pods (istio-proxy) of backend service to reach the right pod (host)?

Please help me understand whether it is possible to use an own application cookie for achieving stickiness via, DestinationRule?

Regards,
Sathya