how to serve multiple service of a container via https in GCE

10/2/2017

I followed the tutorial on kube-lego.

It works perfectly when I only have one service that needs to be accessed via HTTPS protocol. However, if I have following

apiVersion: v1
kind: Service
metadata:
  name: platform
spec:
  type: nodePort
  ports:

    - protocol: TCP
      port: 8002
      nodePort: 30082
      name: grpc

    - protocol: TCP
      port: 8005
      nodePort: 30085
      name: "8005"

    - protocol: TCP
      port: 5672
      nodePort: 30567
      name: "5672"

    - protocol: TCP
      port: 8011
      nodePort: 30811
      name: "8011"

    - protocol: TCP
      port: 8008
      nodePort: 30808
      name: "flow"

  selector:
    run: platform

then I have no idea how to serve all of them via HTTPS protocol because I can only set one of them to port 80. e.g.

- protocol: TCP
      port: 80
      targetPort:8008
      nodePort: 30808
      name: "flow

Ingress only supports service port 80/443 I have no idea how to serve multiple ports from a single container via HTTPS.

-- Junyu
google-compute-engine
kubernetes

1 Answer

10/14/2017

you need the Ingress to help you,

because Ingress is routing by domain name ,so it can support mutli service with https,

use the ingress controller and set hostnetwork true like this yaml,

and set ingress like this yaml, then check whether the http can connect to any service by each domain name,

if can, then add license to build https connect

Good Luck

-- sam
Source: StackOverflow