Could I create an traffic strategy in order to route traffic between services running in different kubernetes' namespaces?
Currently, my testing service is located at staging
namespace. By other hand, my service in production are on production
namespace.
I'd like to balance traffic between service located in staging
namespace and production
namespace. So, 10% goes to staging:service
and 90% goes to production:service
.
Up to now, I've been able to create a virtual service and a destination rule, but both services running inside the same namespace.
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
creationTimestamp: null
name: recommendation
namespace: istio-project
spec:
host: recommendation
subsets:
- labels:
version: v1
name: version-v1
- labels:
version: v2
name: version-v2
And a VirtualService
:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
creationTimestamp: null
name: recommendation
namespace: istio-project
spec:
hosts:
- recommendation
http:
- route:
- destination:
host: recommendation
subset: version-v1
weight: 75
- destination:
host: recommendation
subset: version-v2
weight: 25
This configuration is balancin between both services running inside istio-project
namespace.
Any ideas?
EDIT
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
creationTimestamp: null
name: recommendation
namespace: istio-project
spec:
hosts:
- recommendation
http:
- route:
- destination:
host: recommendation
weight: 75
- destination:
host: recommendation.istio-project-two.svc.cluster.local
weight: 25
---