Best approach to expose kubernetes ingress?

10/30/2018

i'm currently using nginx ingress to expose my apps to outside, currently my approach is like this. My question is this the best way to do it? or if not what would be the best practice.

nginx ingress controller service:-

apiVersion: v1
kind: Service
metadata:
  name: nginx-ingress
spec:
  type: LoadBalancer
  ports:
    - port: 80
      name: http
      protocol: "TCP"
    - port: 443
      name: https
      protocol: "TCP"
  selector:
    app: nginx-ingress-lb

ingress:-

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: app-ingress
spec:
  tls:
  - hosts:
    - myservice.example.com
    secretName: sslcerts
  rules:
  - host: myservice.example.com
    http:
      paths:
      - backend:
          serviceName: myservice
          servicePort: 80
        path: /

so basically i have my nginx ingress controller pods running and expose to a service type of Loadbalacner and i have rules define to determine the routes.

-- Jack
kubernetes
kubernetes-ingress

1 Answer

10/30/2018

The best approach depends on the environment you will choose to build your cluster, whether you consider using Cloud provider or Bare-metal solutions.

In your example, I guess you are using Cloud provider as a Loadbalancer provisioner, which delivers External IP address as an entry point for your NGINX Ingress Controller. Therefore, you have a quite good possibility to scale your Ingress on demand with various features and options.

I found this Article a very useful to make the comparison between implementation of NGINX Ingress Controller on Cloud and Bare-metal environments.

-- mk_sta
Source: StackOverflow