ingress with both rules and default backend in Google Container Engine

7/26/2016

I'm running on the Google Container Engine platform have an ingress that I would like to have a default backend service for almost all of my domains (there are quite a few, but have another, specific service for one domain on it. Going by my understanding of the ingress user guide (scan for "Default Backends:" in there), the config below should work correctly.

However, it doesn't ever create the second backend. Running kubectl describe ingress on the ingress made and when looking at the LB in the Google console site, only the first "default" backend service is listed. Changing the default one into a rule one fixes the problem but means I have to explicitly list all of the domains I want to support.

So, I'm assuming I have a bug in the config below. If so, what is it?

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: boringsites
spec:
  backend:
    serviceName: boringsites
    servicePort: 80
  tls:
    - secretName: boringsites-tls
  rules:
    - host: subdomain.example.com
      http:
        paths:
          - backend:
              serviceName: other-svc
              servicePort: 80
-- jmhodges
google-compute-engine
google-kubernetes-engine
kubernetes

1 Answer

7/27/2016

I just created https://gist.github.com/bprashanth/9f4533b19fd864b723ba0720a3648fa3#file-default-basic-yaml-L94 on kubernetes 1.3 and it works as expected. Perhaps you can debug backwards? Where are you running kube and what version are you using? There is a known and fixed race in 1.2 that you might be running into, especially if you updated the ingress. Also note that you need services of type=nodeport, or the ingress controller on gce will ignore the service you plugged into the reasource.

-- Prashanth B
Source: StackOverflow