Kubernetes is not creating internet-facing AWS Classic Load Balancer

11/5/2019

as far as I get the ingress controller documentation, a simple creation of a Service and an Ingress without special annotations should create internet-facing load balancers, weirdly it is creating internal load balancers. So I added the annotation service.beta.kubernetes.io/aws-load-balancer-internal: "false" which is not working either. By the way, I am using NGINX as ingress controller, in the test cluster currently in version 0.8.21. Probably I should update it some time.

Here's my simple spec-file:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/tls-acme: "true"
    kubernetes.io/ingress.class: nginx
    service.beta.kubernetes.io/aws-load-balancer-internal: "false"
  labels:
    external: "true"
    comp: ingress-nginx
    env: develop
  name: develop-api-external-ing
  namespace: develop
spec:
  rules:
    - host: api.example.com
      http:
        paths:
          - backend:
              serviceName: api-external
              servicePort: 3000
            path: /
  tls:
    - hosts:
        - api.example.com
      secretName: api-tls
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: api
    env: develop
  name: api-external
  namespace: develop
spec:
  ports:
    - name: http
      port: 3000
      protocol: TCP
      targetPort: 3000
  selector:
    app: api
    env: develop
  sessionAffinity: None
  type: ClusterIP
-- Timo
amazon-elb
amazon-web-services
kubernetes
nginx-ingress

2 Answers

11/5/2019

You can setup NLB ( Network load balancer) and provide the URL on ingress rule host values. You don't need to expose the underneath backend service either as NodePort or as another load balancer.

-- Subramanian Manickam
Source: StackOverflow

11/5/2019

You are not wrong, a service and a ingress should create a load balancer... but you should look at the documentation a bit more...

An ingress needs a NodePort service, yours is ClusterIP. So even if it created something it wouldn't work.

In your ingress you are using kubernetes.io/ingress.class: nginx meaning you want to override the default usage of the ingress and force it to register to the ingress-nginx.

So to make it work, change the type of your service, remove the ingress-class annotation.

-- night-gold
Source: StackOverflow