1

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/

Amit Kumar Gupta
  • 17,184
  • 7
  • 46
  • 64
  • I believe there's no way to do redirect HTTP traffic to HTTPS with AWS load balancers in general, so in particular there is likely no way to do this with Kubernetes on AWS and a `Service` of `type: LoadBalancer`. You don't need an ingress controller per se, you could have your pods include a container that receives HTTP traffic and redirects it with a 301. – Amit Kumar Gupta Jul 26 '19 at 02:09
  • If it's ALB, you can use redirection rules. – James Dean Jul 26 '19 at 06:52
  • @MrCholo, eks is self managed kubernetes cluster by aws and ingress controller is a kubernetes resource – c4f4t0r Aug 09 '19 at 12:57

1 Answers1

0

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

Vit
  • 7,740
  • 15
  • 40