Greeting everyone.
I have been beating myself over the past few days with issues. I looked up the forums here and couldn't find my exact problem. It goes like this.
I currently have two ClusterIP Services with a single pod. for each service.
- frontend - pod runs on port 80 -- site.domain.org
- controller (for GraphQL) - runs on port 3000
The website loads fine when I get to the main URL using https://site.domain.org; however, inside the web react code, I have an Apollo client that connects to https://site.domain.org:3000/graphql -- I can't seem to get Traefik to route traffic correctly.
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: ingressroute
namespace: <it is in the same namespace as both controllers>
annotations:
kubernetes.io/ingress.class: traefik-external
spec:
entryPoints:
- websecure
routes:
- kind: Rule
match: Host(`site.domain.org`) && PathPrefix(`/`)
services:
- kind: Service
name: controller
port: 3000
- kind: Rule
match: Host(`site.domain.org`) && PathPrefix(`/graphql`)
services:
- kind: Service
name: controller
port: 3000
tls:
secretName: <tls is generating correctly>
---
apiVersion: v1
kind: Service
metadata:
name: controller
namespace: <it is in the same namespace as both controllers>
spec:
ports:
- protocol: TCP
port: 3000
targetPort: 3000
selector:
run: controller
---
apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: <it is in the same namespace as both controllers>
spec:
ports:
- protocol: TCP
port: 80
targetPort: 80
selector:
run: frontend
I can confirm that I can browse directly to the pod on port 3000 using port forwarding through the Kubernetes environment without issue. So, I suspect that this is going to be a proxy config.
On the web, it does query: https://site.domain.org:3000/graphql, but I can always change this syntax.
Thanks,
Shane