Is there a way to set canary or weighted deployments on kubernetes service level without using ingress/gateway?

10/10/2019

I can set weight or filter by headers on a virtual service. So, I access using a ingress/gateway and I have success using weight and header filters. But I would like to set this conditions on a service level, to access inside the cluster. I am using ISTIO.

Anyone know anything about that?

-- Danilo
canary-deployment
envoyproxy
istio
kubernetes

1 Answer

10/11/2019

No, there is no way to do that. You can check kubernetes' services documentation to assure it documentation. In summary, kubernetes uses IP tables to do the load balancing and a forced statistical round robin policy (check this link).

However it is not that hard to actually solve it in kubernetes using other technologies. Using a proxy in between with a weighted upstream would solve the problem inmediately. Something like this:

upstream dynamic {
    server pod-proxy-1      weight=2;
    server pod-proxy-2      weight=4;
}

server {
    location / {
        proxy_pass http://dynamic;
    }
}
-- Rodrigo Loza
Source: StackOverflow