Can I use EKS NodePort service with port 80 and 443

4/24/2019

I am using EKS (K8s service natively provided by AWS).

My questions are:

  1. Is it possible to expose NodePort service through port 80 and 443 (default NodePort range is 30000 - 32767).
  2. If it is, how to do that with EKS.

Note I know the consequences of using NodePort services and have researched alternatives like LoadBalancer and Ingress. I am going ahead with NodePort because I have to.

-- Tran Triet
amazon-eks
eks
kubernetes

2 Answers

4/24/2019
  1. No. According to the EKS AMI Source, the worker nodes' kubelets use the default configuration for --service-node-port-range. You will be assigned an external port number between 30000-32767.

  2. You have the alternative of using the node's hostNetwork to expose port 80 and 443 as hostPort. A description of the setup can be found here. Just keep in mind the networking constraints and caveats of using a hostNetwork!

Hope this helps!

-- Frank Yucheng Gu
Source: StackOverflow

4/24/2019

Try using externalIPs for your Service:

kind: Service
apiVersion: v1
metadata:
  name: my-service
spec:
  selector:
    app: MyApp
  ports:
  - name: http
    protocol: TCP
    port: 80
    targetPort: 80
  externalIPs:
  - node1_IP
  - node2_IP
  - node3_IP

In that case port 80 will also be opened on node IPs. This is a dirty workaround but it should work.

-- Vasily Angapov
Source: StackOverflow