<p>I am trying to learn how to use Kibernetes with Minikube and have the following deployment and service:</p>

<pre><code>---
kind: Service
apiVersion: v1
metadata:
  name: exampleservice
spec:
  selector:
    app: myapp
  ports:
  - protocol: "TCP"
    # Port accessible inside cluster
    port: 8081
    # Port to forward to inside the pod
    targetPort: 8080
    # Port accessible outside cluster
    nodePort: 30002
  type: LoadBalancer
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: myappdeployment
spec:
  replicas: 5
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: tutum/hello-world
        ports:
        - containerPort: 8080
</code></pre>

<p>I expect to be able to hit this service from my local machine at </p>

<pre><code>http://192.168.64.2:30002
</code></pre>

<p>As per the command: <code>minikube service exampleservice --url</code> but when I try to access this from the browser I get a site cannot be reached error.</p>

<p>Some information that may help debugging:</p>

<p><code>kubectl get services --all-namespaces</code>:</p>

<pre><code>NAMESPACE     NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
default       exampleservice         LoadBalancer   10.104.248.158   &lt;pending&gt;     8081:30002/TCP           26m
default       kubernetes             ClusterIP      10.96.0.1        &lt;none&gt;        443/TCP                  2h
default       user-service-service   LoadBalancer   10.110.181.202   &lt;pending&gt;     8080:30001/TCP           42m
kube-system   kube-dns               ClusterIP      10.96.0.10       &lt;none&gt;        53/UDP,53/TCP,9153/TCP   2h
kube-system   kubernetes-dashboard   ClusterIP      10.110.65.24     &lt;none&gt;        80/TCP                   2h
</code></pre>

<p>I am running minikube on OSX.</p>

<p>You can use <strong>External IPs</strong>, as described in <a href="https://kubernetes.io/docs/concepts/services-networking/service/#external-ips" rel="nofollow noreferrer">k8s docs</a>. Update the service as shown below (where I assume <code>192.168.64.2</code> is your minikube IP):</p>
<pre><code>kind: Service
apiVersion: v1
metadata:
  name: exampleservice
spec:
  selector:
    app: myapp
  ports:
  - protocol: &quot;TCP&quot;
    # Port accessible inside cluster
    port: 8081
    # Port to forward to inside the pod
    targetPort: 80
    # Port accessible outside cluster
    nodePort: 30002
  type: LoadBalancer
  externalIPs:
  - 192.168.64.2
</code></pre>
<p>Now you can access your application at <a href="http://192.168.64.2:8081/" rel="nofollow noreferrer">http://192.168.64.2:8081/</a></p>
<hr />
<p>If you need to access the application at 30002, you can use it like this</p>
<pre><code>    kind: Service
    apiVersion: v1
    metadata:
      name: exampleservice
    spec:
      selector:
        app: myapp
      ports:
      - protocol: &quot;TCP&quot;
        # Port accessible inside cluster
        port: 8081
        # Port to forward to inside the pod
        targetPort: 80
        # Port accessible outside cluster
        nodePort: 30002
      type: NodePort
</code></pre>
<hr />
<p>Your deployment file does not look correct to me.</p>
<p>delete it
<code>kubectl delete deploy/myappdeployment</code></p>
<p>use this to create again.</p>
<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  labels:
    app: myapp
  name: myappdeployment
spec:
  replicas: 5
  selector:
    matchLabels:
      app: myapp
  strategy: {}
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - image: tutum/hello-world
        name: myapp
        ports:
        - containerPort: 80
</code></pre>
