I am new to K8s and just hosted my first ASP.NET core containerized app on local machine using K8s. The issue I am facing is the external service called NodePort is not accessible using the nodePort:30100 port (nodeId:nodePort). When I am accessing through the url I get from
minikube service service-name –url
I can access the application running (which is different from the nodePort I have mentioned in yaml file e.g. 127.0.0.1:53554) but why not directly through the 30100 port of the node? I am just confused in it. Here is my deployment + service yaml file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: weather-app-deployment
labels:
app: weather-app
spec:
replicas: 1
selector:
matchLabels:
app: weather-app
template:
metadata:
labels:
app: weather-app
spec:
containers:
- name: weather-app
image: usmaniftakhar/weather-app:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: weather-app-service
spec:
type: NodePort
selector:
app: weather-app
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30100
Thank you very much