Can't Access the Application through the NodePort via browser

29 Views Asked by At

I am trying to run a sample application via nodeport on browser on minikube which is installed using docker as driver, I have deployed the pods using following deployment.yml:

<<deployment.yml>>

apiVersion: apps/v1
kind: Deployment
metadata:
  name: python-app
  labels:
    app: sample-python-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: sample-python-app
  template:
    metadata:
      labels:
        app: sample-python-app
    spec:
      containers:
      - name: python-app
        image: SK/sample_image:firsttry
        ports:
        - containerPort: 8000

I created service using below service.yml

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    app: sample-python-app
  ports:
    - port: 80
      targetPort: 8000
      nodePort: 30007

then i tried running the app using curl cmd using node IP address and is successful as shown below:

$ minikube ip
192.168.49.2

$ curl -L http://192.168.49.2:30007/demo

but when i tried same thing via browser, it is not accessible giving error "site can't be reached" as shown below:

enter image description here

Kindly suggest the way forward as i tried searching online for solution but i got confused as i am new to this.

0

There are 0 best solutions below