In the documentation about NodePort, you can find that this type can allocate ports from range 30000-32767.
However there is a workaround. If you will add a special flag --service-node-port-range with requested range,
admission controller allow you to create NodePort with Ports 80 and 443.
You will need to go to /etc/kubernetes/manifests/, edit kube-apiserver.yaml with sudo and add entry
- --service-node-port-range=1-32767. After that you need to save it.
Now you will need to create service. To do that you need to edit this yaml and in ports add node port to spec.ports
Before:
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
- name: https
port: 443
targetPort: 443
protocol: TCP
After:
ports:
- name: http
nodePort: 80
port: 80
protocol: TCP
targetPort: 80
- name: https
nodePort: 443
port: 443
protocol: TCP
targetPort: 443
After thoses changes you can edit again kube-apiserver.yaml in /etc/kubernetes/manifests/ and comment it using # in the same line as - --service-node-port-range.
Then you will be able to curl this NodePort address and Node address.
EDIT:
After clarification
Ingress can be deployed in two ways. The first one is deploy Nginx as Deamonset which is requiring hostPort inside configuration file. However there is another option, you can deploy Nginx as Deployment.
NodeIP and Known Port: Pods in the DaemonSet can use a hostPort, so
that the pods are reachable via the node IPs. Clients know the list of
node IPs somehow, and know the port by convention.
However in the bottom of the page you can find:
DaemonSets are similar to Deployments in that they both create Pods,
and those Pods have processes which are not expected to terminate
(e.g. web servers, storage servers).
Use a Deployment for stateless services, like frontends, where scaling
up and down the number of replicas and rolling out updates are more
important than controlling exactly which host the Pod runs on. Use a
DaemonSet when it is important that a copy of a Pod always run on all
or certain hosts, and when it needs to start before other Pods.
You need to deploy Ingress as Deployment and not as Deamonset.
Example of Nginx Deployment can be found here.
As Deployment is not requiring hostPort you will be able to create pods without this parameter.