I have 2 services with DestinationRule enabled in both the services. I have been able to achieve session affinity for external calls to the services individually. When I try to perform an internal call from Service A to Service B, the DestinationRule is applied to Service A but it's not applied to Service B.
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: isito-affinity-service-a
namespace: dev
spec:
host: service-a.dev.svc.cluster.local
trafficPolicy:
loadBalancer:
consistentHash:
httpHeaderName: x-connection
Similar destination rule for Service B is applied.I was able to verify this because I have the services running in Flask and I generate a random UUID on startup of the service. This UUID is returned with a response. Every time I hit the service directly I get the same random ID but once I hit the API to perform internal service call, I get random ID for the service that is called internally. I have scoured the internet for a proper reference or documentation and I'm unable to find any.
I'm using the requests package to make the internal service call from Service A to Service B like this response = requests.get("http://service-b.dev.svc.cluster.local/user/internal", headers=request.headers)
I also made sure to automatically inject sidecar for the dev namespace in k8. I also have VirtualService configured for both Service A and B. All of my setup is done and tested with minikube. It'd be really helpful if anyone has an idea to overcome this issue. Thanks in advance.
TLDR: DestinationRule is not being applied for internal service calls with istio