Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Services with multiple ports mixing up in maesh #423

Closed
tornyairoland opened this issue Feb 13, 2020 · 3 comments · Fixed by #428
Closed

Services with multiple ports mixing up in maesh #423

tornyairoland opened this issue Feb 13, 2020 · 3 comments · Fixed by #428
Milestone

Comments

@tornyairoland
Copy link

Hi!

We have a Service that has two ports: port 80 is used from inside the cluster, port 8080 is accessed externally.
Using maesh and calling the service with the .maesh DNS name and port 80, the request sometimes gets routed to port 8080 of the service, which causes problems.
We found that for each of the maesh-created services have both endpoints, are they supposed to be in both of them? If so, how does maesh decide which one to route to?

Service configuration:

{
    "apiVersion": "v1",
    "kind": "Service",
    "metadata": {
        "name": "dliver-direct-message-service",
        "namespace": "sbx"
    },
    "spec": {
        "clusterIP": "172.20.219.199",
        "ports": [
            {
                "name": "api",
                "port": 80,
                "protocol": "TCP",
                "targetPort": 80
            },
            {
                "name": "public",
                "port": 8080,
                "protocol": "TCP",
                "targetPort": 8080
            }
        ],
        "selector": {
            "app": "dliver-direct-message-service"
        },
        "type": "ClusterIP"
    },
    "status": {
        "loadBalancer": {}
    }
}

Maesh service configuration:

{
    "apiVersion": "v1",
    "kind": "Service",
    "metadata": {
        "labels": {
            "app": "maesh"
        },
        "name": "infra-dliver-direct-message-service-6d61657368-sbx",
        "namespace": "infra",
    },
    "spec": {
        "clusterIP": "172.20.243.188",
        "ports": [
            {
                "name": "api",
                "port": 80,
                "protocol": "TCP",
                "targetPort": 5000
            },
            {
                "name": "public",
                "port": 8080,
                "protocol": "TCP",
                "targetPort": 5001
            }
        ],
        "selector": {
            "component": "maesh-mesh"
        },
        "type": "ClusterIP"
    },
    "status": {
        "loadBalancer": {}
    }
}

Controller configuration from the controller API:

{
  "http": {
    "routers": {
       // ...
      "dliver-dir-sbx-80-0504adbb248e7344": {
        "entryPoints": [
          "http-5000"
        ],
        "service": "dliver-dir-sbx-80-0504adbb248e7344",
        "rule": "Host(`dliver-direct-message-service.sbx.maesh`) || Host(`172.20.219.199`)"
      },
      "dliver-dir-sbx-8080-20e3ccec1dd7334b": {
        "entryPoints": [
          "http-5001"
        ],
        "service": "dliver-dir-sbx-8080-20e3ccec1dd7334b",
        "rule": "Host(`dliver-direct-message-service.sbx.maesh`) || Host(`172.20.219.199`)"
      },
      // ...
    },
    "services": {
        // ...
      "dliver-dir-sbx-80-0504adbb248e7344": {
        "loadBalancer": {
          "servers": [
            {
              "url": "http://10.152.1.53:8080"
            },
            {
              "url": "http://10.152.1.53:80"
            }
          ],
          "passHostHeader": true
        }
      },
      "dliver-dir-sbx-8080-20e3ccec1dd7334b": {
        "loadBalancer": {
          "servers": [
            {
              "url": "http://10.152.1.53:8080"
            },
            {
              "url": "http://10.152.1.53:80"
            }
          ],
          "passHostHeader": true
        }
      },
      // ...
    }
  },
  "tcp": {}
}

Kubernetes version: v1.14.9-eks-c0eccc
Maesh version: v1.1.0-rc1

@dtomcej
Copy link
Contributor

dtomcej commented Feb 15, 2020

Thanks for this report. Will try to repro, and will reply back on this ticket with my results.

@dtomcej
Copy link
Contributor

dtomcej commented Feb 18, 2020

Hi @tornyairoland,

Thanks for the great bug report. Was super easy to reproduce your issue from your objects and API configuration report.

I have created a PR to fix it, and will be included in the next RC release.

@traefiker
Copy link
Contributor

Closed by #428.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants