Kubernetes Services enable communication between various components within and outside of the application. Kubernetes Services helps us connect applications together with other applications or users.
Port on the Node itself which we use to access the web server externally. NodePorts can only be in a valid range which is from 30000 to 32767
To link the service to the pod, bring the labels
section of pod-definition.yaml
to selector
![[Pasted_image_20240626085826.png]]
selector
with labels
of pod, service will then distribute the balance automatically. It also map the pod to the nodeport, making it available to users.![[Pasted image 20240626094726.png]]
targetPort
is the port where the backend is exposedport
is where the service is exposed