I would like to bind my service on all nodes to ports 80 and 443, so that I will be redirected via a DNS name (kubernetes) to any node that redirects me directly to the service via HTTP/S and then to the deployment (nginx). However, I don't know exactly how this works, because the range of the NodePorts only goes from 30000 to 32xxx.
Here is my setup
DNS-Name IPv4
k8s-master 172.25.35.47
k8s-node-01 172.25.36.47
k8s-node-02 172.25.36.8
kubernetes 172.25.36.47
kubernetes 172.25.36.8
My yaml-file
apiVersion: v1
kind: Service
metadata:
name: proxy
spec:
ports:
- name: http
nodePort: 80
port: 80
protocol: TCP
targetPort: 80
- name: https
nodePort: 443
port: 443
protocol: TCP
targetPort: 443
selector:
name: proxy
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: proxy
labels:
name: proxy
spec:
selector:
matchLabels:
name: proxy
replicas: 1
template:
metadata:
labels:
name: proxy
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
Which type of service provide me a function to expose this ports or how I can realize my mental setup?
Volker