I declared a service in nodePort mode. but there's something I don't understand. maybe I'm getting confused. The nodePort, forwarded to the service’s port, and received on the targetPort by the pod.
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: {{ .Release.Name }}
product: {{ .Values.product }}
environment: {{ .Values.environment }}
version: {{ .Values.version }}
component: frontend
spec:
type: NodePort
ports:
- port: 6001
targetPort: 6001
protocol: TCP
selector:
app: countly-frontend
when I list the services on kubernetes I see this :
service/countly-frontend NodePort 10.xx.xx.12 <none> 6001:31145/TCP 110s
normally I should see 6001:6001 and not 6001:31145 ? The app is listening on port 6001 as you may have guessed.