How to route traffic to 2 services using GCK ingress

101 views Asked by At

I have a very basic question about ingress routing as my knowledge is minimal and we are using ingress controller. We are using GCK for our services.

  1. Currently we have a service running on node which is working fine.
  2. We want to shift this service to new framework, shifting is done. Now come the deployment of new service and how to route traffic gradually to this instance. Are there any rules available to share traffic to different services?
  3. And can we control the the traffic routing in terms of percentage? Like initially 10% of traffic is routed to new instance, similarly if something goes wrong decrease this percentage to 0.

Please suggest and share the proper configurations or documentation.

2

There are 2 answers

0
Ray John Navarro On

You can distribute the traffic based on weights assigned to different service versions. For instance, in Istio, you use the VirtualService to split traffic based on defined weights.

apiVersion: [networking.istio.io/v1alpha3](http://networking.istio.io/v1alpha3) 
kind: VirtualService     
metadata: 
 name: myservice 
spec: 
 hosts:    
   - myservice     
   http:    
    - route:    
       - destination:    
             host: myservice    
             subset: v1    
         weight: 60    
       - destination:     
              host: myservice    
              subset: v2     
         weight: 40

In this sample, 60% of traffic goes to the v1 subset, and 40% goes to v2. Just tweak it based on how you want the traffic to behave. Attached is documentation for Traffic management.[1]

[1] https://istio.io/latest/docs/concepts/traffic-management/

0
3-commerce On

In my personal experience, i can suggest these features below;

  1. Cloudflare Worker (my previous question)
  2. Istio Traffic route or Cannary method
  3. Nginx Ingress

It depens your current architecture. All of your goals to achieve can be solved by one of those methods.