Exposing service in kubernetes pods with aws alb ingress controller

2/15/2019

I am new to k8s and exploring more on production grade deployment. We have py Django app which is running in (say in 9000) node port. When I try to expose them using a k8s-service ELB, - it works by running 80 and 443 separately; where as 80 to 443 redirection is not supported in AWS classic ELB.

Then I switched to aws alb ingress controller; the problem i faced was - ALB does not works with node port and only with http and https port.

Any thoughts would be much appreciated!!

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ABC
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/target-type: instance
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/subnets: 'subnet-1, subnet-2'
    alb.ingress.kubernetes.io/security-group: sg-ABC
    alb.ingress.kubernetes.io/healthcheck-path: "/"
    alb.ingress.kubernetes.io/success-codes: "200"
  labels:
    name: ABC
spec:
  rules:
    - http:
        paths:
         - path: /
           backend:
             serviceName: ABC
             servicePort: 80 ```
-- Jothimani
amazon-web-services
kubernetes

1 Answer

2/15/2019

Thank you @sulabh and @Fahri it works perfect now. I went through the doc again and corrected my mistake.

Issues was with route path in ALb;

Setup is like;

python-django-uwsgi app in pods and expose it as service in NodePort and use aws ingress controller for ALB;

Cheers!

-- Jothimani
Source: StackOverflow