Closed jackpf closed 2 weeks ago
Hey @jackpf, the simplest answer here is that in edge-24.7.1
you should probably just use HTTPRoutes for this, rather than TrafficSplits.
You'll need to make sure that you have the Gateway API CRDs installed (which will possibly require you to have installed Linkerd with --set enableHttpRoutes=false
at the moment -- if you didn't do that, let me know):
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/experimental-install.yaml
We'll still use your traffic-split-service
:
---
apiVersion: v1
kind: Service
metadata:
name: traffic-split-service
namespace: linkerd-diff-ns
spec:
ports:
- protocol: TCP
port: 80
targetPort: 80
name: external
After that, we'll create two Gateway API ReferenceGrants to tell Gateway API that it's OK to route traffic from linkerd-diff-ns
to app-1-ns
and app-2-ns
:
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: ReferenceGrant
metadata:
name: app-1-ns-grant
namespace: app-1-ns
spec:
from:
- group: gateway.networking.k8s.io
kind: HTTPRoute
namespace: linkerd-diff-ns
to:
- group: ""
kind: Service
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: ReferenceGrant
metadata:
name: app-2-ns-grant
namespace: app-2-ns
spec:
from:
- group: gateway.networking.k8s.io
kind: HTTPRoute
namespace: linkerd-diff-ns
to:
- group: ""
kind: Service
and then finally, we can create an HTTPRoute that intercepts traffic to traffic-split-service
and splits it 50/50 between app-1-service
and app-2-service
:
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: app-traffic-split
namespace: linkerd-diff-ns
spec:
parentRefs:
- name: traffic-split-service
kind: Service
group: core
port: 80
rules:
- backendRefs:
- name: app-1-service
namespace: app-1-ns
port: 80
weight: 50
- name: app-2-service
namespace: app-2-ns
port: 80
weight: 50
I think this should do what you want.
I'm going to go ahead and close this one – feel free to reopen if you need to!
What is the issue?
Hi, I'm trying to get linkerd to perform traffic splitting between services running in different namespaces.
I'm attempting to use
ExternalName
services as bridges between the namespaces, but this seems to be where things stop working. If I run everything in the same namespace, the traffic split works correctly.Is this a bug, or maybe this isn't the correct way to configure splits between namespaces? I couldn't find any relevant info in the docs.
How can it be reproduced?
Here is a sample config of what I'm trying to achieve - running
app-1
andapp-2
in separate namespaces. Then having the traffic split andExternalName
services as bridges to app-1 and app-2 running in thelinkerd-diff-ns
namespace.Logs, error output, etc
Everything seems to work apart from the traffic split.
The only error I've been able to find from the linkerd container is:
output of
linkerd check -o short
Environment
Kubernetes:
Cluster environment: EKS
Host OS: Amazon Linux 2 - Linux 5.10.219-208.866.amzn2.aarch64 #1 SMP Tue Jun 18 14:00:02 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Linkerd version:
Possible solution
No response
Additional context
No response
Would you like to work on fixing this bug?
None