k8s ingress multiple with tls hosts

11/6/2018

I'm trying to configure an ingress on gke to serve two different ssl certificates on two different hosts.

My SSl certificates are stored as secrets and my k8s version is 1.10.9-gke.0 (I'm currently trying to upgrade to 1.11 to see if that changes anything).

Here is my ingress configuration :

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/backends: '{"k8s-be-30086--b1574396a1d7162f":"HEALTHY","k8s-be-31114--b1574396a1d7162f":"HEALTHY"}'
    ingress.kubernetes.io/forwarding-rule: k8s-fw-default-si-preproduction-ingress--b1574396a1d7162f
    ingress.kubernetes.io/https-forwarding-rule: k8s-fws-default-si-preproduction-ingress--b1574396a1d7162f
    ingress.kubernetes.io/https-target-proxy: k8s-tps-default-si-preproduction-ingress--b1574396a1d7162f
    ingress.kubernetes.io/ssl-cert: k8s-ssl-default-si-preproduction-ingress--b1574396a1d7162f
    ingress.kubernetes.io/static-ip: k8s-fw-default-si-preproduction-ingress--b1574396a1d7162f
    ingress.kubernetes.io/target-proxy: k8s-tp-default-si-preproduction-ingress--b1574396a1d7162f
    ingress.kubernetes.io/url-map: k8s-um-default-si-preproduction-ingress--b1574396a1d7162f
  creationTimestamp: 2018-10-26T09:45:46Z
  generation: 9
  name: si-preproduction-ingress
  namespace: default
  resourceVersion: "1846219"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/si-preproduction-ingress
  uid: e9bba9ad-d903-11e8-872e-42010a840feb
spec:
  tls:
  - hosts:
    - domain_1
    secretName: cert_1
  - hosts:
    - domain_2
    secretName: cert_2
  rules:
  - host: domain_1
    http:
      paths:
      - backend:
          serviceName: si-preproduction-service
          servicePort: 80
        path: /*
  - host: domain_2
    http:
      paths:
      - backend:
          serviceName: si-preproduction-service
          servicePort: 80
        path: /*
status:
  loadBalancer:
    ingress:
    - ip: our_ip

My cert_1 is correctly served on domain_1 but it is also served on domain_2 (instead of cert_2) and therefore not securing my connections has it is supposed to.

I'm also opening an issue on github here.

-- Mathieu K.
google-kubernetes-engine
kubernetes
kubernetes-ingress
ssl

1 Answer

11/7/2018

Upgrading to k8s 1.11+ solved the problem.

-- Mathieu K.
Source: StackOverflow