<p>I have created a simple php application trying to access from kubernetes cluster but I am unable access the application </p>

<p>my deployment.yml</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpdeployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: phpapp
  template:
    metadata:
      labels:
        app: phpapp
    spec:
      containers:
      - image: rajendar38/myhtmlapp
        name: myhtmlapp
        ports:
        - containerPort: 80
</code></pre>

<p>my service.yml</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: php-service
spec:
  selector:
    app: myhtmlapp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      nodePort: 31000
  type: NodePort

rajendar@HP-EliteBook:~/Desktop/work$ kubectl get services
NAME          TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes    ClusterIP   10.96.0.1        &lt;none&gt;        443/TCP        26h
my-service    ClusterIP   10.102.235.244   &lt;none&gt;        4000/TCP       24h
php-service   NodePort    10.110.73.30     &lt;none&gt;        80:31000/TCP   22m
</code></pre>

<p>I am using minikube for this application 
when I am trying to connect to http:127.0.0.1:31000/test.html
I unable to connect to application </p>

<p>Thanks</p>

<p>Rajendar</p>

Rajendar Talatam
<p>Minikube is using a virtual machine to provide the single node cluster.
When exposing a NodePort service it is local from the perspective of the VM, which is usually not the same as your local machine.</p>

<p>Use <code>minikube ip</code> to determine the IP of the machine and use that IP instead of <code>localhost</code> or <code>127.0.0.1</code> to access NodePort services on the minikube cluster.</p>
