Implementing traffic distribution among micro-service deployments in Kubernetes without Ingress

hey folks :wave: , hope you are having/had a great day :smile:
we have a use-case where our micro-service A in namespace X needs to talks micro-service B in namespace Y. Condition is that for each micro-service we have 3 deployments each, base, baseline and canary and traffic should be distributed among three deployments based on some weight. Can we achieve this without making use of Ingress ? attached is the high level architecture which we want to achieve.
Thanks

hello! Did you try using service FQDN

no, can you please help with one example?

It is like

service-1.namespace-1.svc.cluster.local

yeah that I am already using but if you see the diagram, there are 3 instances of the same application and load from application A should be equally distributed to application B’s (3 deployments)

Are you using service mesh?

but with traefik, we would have to create IngressRoute which will help with traffic splitting but then we’ll have to do DNS resolution outside of cluster, right?

application A β†’ route 53 resolution β†’ AWS ALB β†’ traefik β†’ k8s service β†’ application B

please correct me I am wrong here :sweat_smile:

May be you can try service mesh istio

it will be a big change for our prod cluster :sweat_smile:

And you are also using HPA ?

but HPA will scale up/down the no of pods of a particular deployment. The reason why we are maintaining 3 versions of an application is one would be canary with 2% traffic, one would be baseline again with 2% traffic and last one would be having 96% traffic with HPA enabled

btw, can we create Ingress and pass k8s fqdn as host? something like

kind: IngressRoute
metadata:
  annotations:
    <http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>: traefik-internal
  creationTimestamp: "2024-01-17T10:51:52Z"
  name: gcoms-test-int
  namespace: gcoms-test
  uid: 5c7a9a44-f237-4c03-972a-feeb73e26c5b
spec:
  routes:
  - kind: Rule
    match: Host(`wallet-test.wallet.svc.cluster.local`) && PathPrefix(`/`)
    middlewares:
    - name: headers-common
      namespace: traefik-v2-flux
    - name: headers-common-cache-control
      namespace: gcoms-test
    services:
    - kind: Service
      name: gcoms-test
      namespace: gcoms-test
      port: 80
      weight: 96
    - kind: Service
      name: gcoms-test-baseline
      namespace: gcoms-test
      port: 80
      weight: 2
    - kind: Service
      name: gcoms-test-canary
      namespace: gcoms-test
      port: 80
      weight: 2```

I have never tested IngressRoute Object. You are facing problem with ingress object?

nope, IngressRoute is fine, what I was trying to ask here was can we do something like

    match: Host(`wallet-test.wallet.svc.cluster.local`) && PathPrefix(`/`)```


?
here our host is k8s dns

I don’t think we can use service fqdn as it is not accessible outside the cluster

yeah that was my assumption as well :sweat_smile:

https://argo-rollouts.readthedocs.io/en/stable/

I think that using an Ingress (load-balancer) instead of the simple Service name for intra-cluster communication is sub-optimal but you cannot do without if you need canary-deployment.