0

I am trying to troubleshoot per subject an issue with Kubernetes where pods need to contact a .NET Core API service in my host's localhost.

The default deployment YAML file can be found here: Synapse Serverless Workflow K8s YAML

I have added in that file this configuration (advice taken from this SO post):

---

kind: Service
apiVersion: v1
metadata:
  name: synapse-ingress-service
  namespace: synapse
  labels: 
    app: synapse-ingress-service
  annotations:
    kubernetes.io/ingress.class: "traefik"
spec:
  ports:
    - name: http-ingress
      port: 5296
      targetPort: 5296
  type: ExternalName
  externalName: kubernetes.docker.internal
  selector:
    app: synapse

---

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: backend-ingress
  namespace: synapse
  labels: 
    app: synapse-ingress
  annotations:
    kubernetes.io/ingress.class: "traefik"
spec:
  ingressClassName: traefik
  rules:
    - host: localhost
      http:
        paths:
          - path: /api/Email/Customer
            pathType: Exact
            backend:
              service:
                name: synapse-ingress-service
                port:
                  number: 5296
          - path: /swagger/v1/swagger.json
            pathType: Exact
            backend:
              service:
                name: synapse-ingress-service
                port:
                  number: 5296

---

However, I cannot make it work. What I am trying is for the pods to be able to query my host's localhost API service using the HTTP verbs (GET / POST etc). Any ideas anyone?

P.S.: I am not looking to deploy my .NET API in the Kubernetes cluster ... yet! :P

Kounavi
  • 1,090
  • 1
  • 12
  • 24
  • Your local system needs to be running a service reachable from the cluster. You should be able to configure the services running in the cluster to use the out-of-cluster server's DNS name normally. It doesn't particularly matter that the remote server, each Node, and each Pod individually believes they themselves are "localhost". – David Maze Aug 15 '23 at 18:58
  • 1
    (This question somewhat implies you have a single server only with some services running outside the Kubernetes environment. If you only have a single server, a plain-Docker environment might be lighter-weight and easier to manage. If this is a test setup for a larger environment, where will the service be running when deployed? What Kubernetes environment are you using in this case?) – David Maze Aug 15 '23 at 19:00

0 Answers0