Use aws-load-balancer to redirect to 301 - or do I need an ingress-controller

7/26/2019

Frankly am not quite sure of the difference between an EKS Service and an IngressController. I have this service:

apiVersion: v1
kind: Service
metadata:
  namespace: entity-tools-integration
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-west-2:913xxx371:certificate/d98d8d07
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
    service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
  labels:
    app: entity-tools-integration
  name: entity-tools-integration
spec:
  type: LoadBalancer
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 80
    - name: https
      protocol: TCP
      port: 443
      targetPort: 80
  selector:
    app: entity-tools-integration

I just want to redirect http traffic on port 80 to https on 443 - my question - is there way to configure my service to do that, or do I need an ingress-controller? for an ingress controller (which I would like to avoid if possible) the relevant config is something like this:

https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/tasks/ssl_redirect/

--
eks
kubernetes

1 Answer

8/9/2019

You are not able to do this via service and have to use ingress controller, but look at Tenzer workaround. I t contains good solution with an explanation how to preporly configure both service and nginx-configuration configmap.

Alternativelly you can use your approach with https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/tasks/ssl_redirect/ or lokk into Kubernetes HTTP to HTTPS Redirect on AWS with ELB terminating SSL post

-- VKR
Source: StackOverflow