I'm new to Kubernetes and I'm setting up my first project. The application responds with a hello world message on the '/' route. Here is my deployment file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-deployment
labels:
app: my-app
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: my_app:0.1
resources:
imagePullPolicy: Never
ports:
- containerPort: 8000
And here is my service:
apiVersion: v1
kind: Service
metadata:
name: my-app-service
spec:
type: NodePort
selector:
app: my-app
ports:
- protocol: TCP
port: 8000
targetPort: 8000
nodePort: 30001
I execute the following command to get the node IP: kubectl get node -o wide and the output is:
karol-ms-7972 Ready control-plane,master 18h v1.30.4+k3s1
192.168.8.106 Ubuntu 22.04.5 LTS 6.8.0-40-generic containerd://1.7.20-k3s1
I type 192.168.8.106:30001 in my browser (also tried with curl) and nothing is there. When I execute curl localhost:8000 in the pod, I get the expected response, so the problem is with the Service, not the Pod.
I'll appreciate all the hints.