Get ingress working with DNS with Kubernetes (GCE)

2/11/2017

I've got one Kubernetes cluster which runs a backend & front-end (on different containers). I've setup an ingress controller which is suppose to route api.mydomain.com to service > port 8080 & mydomain.com to service > 80. However this isn't working, I just get the following error:

Error: Server Error

The server encountered a temporary error and could not complete your request.
Please try again in 30 seconds.

Here is the following setup of my containers/

{
"name": "frontend",
"image": "gcr.frontend-image:latest",
"ports": [
 {
      "containerPort": 80
 }
],
... Other setup for container 
}

Backend:

{
"name": "backend",
"image": "gcr.backend-image:latest",
"ports": [
 {
   "containerPort": 8080
 }
],
... other setup for container
}

My ingress file looks like:

"spec": {
    "rules": [
      {
        "host": "api.mydomain.com",
        "http": {
          "paths": [
            {
              "path": "/",
              "backend": {
                "serviceName": "service",
                "servicePort": 8080
              }
            }
          ]
        }
      },
      {
        "host": "mydomain.com",
        "http": {
          "paths": [
            {
              "path": "/",
              "backend": {
                "serviceName": "service",
                "servicePort": 80
              }
            }
          ]
        }
      }
    ]
  }

Running the following ingress should setup the sub domain & routing right? However I get the error listed above ^

Do I have to setup the api.mydomain.com up in my DNS records? I did do this & pointed both the api.mydomain & www.mydomain to the ingress controller IP (load balancer IP).

-- James111
dns
google-cloud-platform
kubernetes

0 Answers