I am using EKS (K8s service natively provided by AWS).
My questions are:
NodePort service through port 80 and 443 (default NodePort range is 30000 - 32767).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.
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.
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!
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_IPIn that case port 80 will also be opened on node IPs. This is a dirty workaround but it should work.