Access service via custom HTTPS port using nginx-ingress

4/17/2019

When using nginx-ingress in Kubernetes, how can I define a custom port which should be used for HTTPS, instead of 443? My configuration looks as follows:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/tls-acme: "true"
  creationTimestamp: "2019-04-17T14:15:25Z"
  generation: 3
  name: foo
  namespace: foo
  resourceVersion: "1535141"
  selfLink: /apis/extensions/v1beta1/namespaces/foo/ingresses/foo
  uid: f1b4dae9-6072-1239-a12a-fa161aff25ae
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: foo
          servicePort: 80
        path: /
  tls:
  - hosts:
    - example.com
    secretName: foo-ingress-tls
status:
  loadBalancer:
    ingress:
    - {}

Preferably, I would like to be able to access the service via HTTPS on both the default 443 port and an additional custom port.

-- watain
cert-manager
kubernetes
kubernetes-ingress
nginx-ingress

1 Answer

4/17/2019

Unfortunately in ingress-nginx it is impossible to listen to more than one HTTPS port. You can change HTTPS port number using --https-port command line argument, but there can only be one HTTPS port.

-- Vasily Angapov
Source: StackOverflow