<p>Kubernetes newbie here. Just want to get my fundamental understanding correct. Minikube is known for local development and is it possible for connection outside (not just outside cluster) to access the pods I have deployed in minikube? </p>

<p>I am running my minikube in ec2 instance so I started my minikube with command <code>minikube start --vm-driver=none</code>, which means running minikube with Docker, no VM provisioned. My end goal is to allow connection outside to reach my pods inside the cluster and perform POST request through the pod (for example using Postman). </p>

<blockquote>
  <p>If yes, I also have my service resource applied using <code>kubectl apply
  -f</code> into my minikube using NodePort in yaml file. Also, I also wish to understand <code>port</code>, <code>nodePort</code>, and <code>targetPort</code> correctly. <code>port</code> is
  the port number assigned to that particular service, <code>nodePort</code> is the
  port number on the node (in my case is my ec2 instance private IP),
  <code>targetPort</code> is the port number equivalent to the <code>containerPort</code> I've
  assigned in yaml of my deployment. Correct me if I am wrong in this statement.</p>
</blockquote>

<p>Thanks. </p>

rick
<p>Yes you can do that</p>

<p>as you have started the minikube with : </p>

<pre><code>minikube start --vm-driver=none
</code></pre>

<p><code>nodePort</code> is the port that a client outside of the cluster will "see". nodePort is opened on every node in your cluster via kube-proxy. You can use nodePort to access the application from outside world. Like <code>https://loadbalancerIP:NodePort</code></p>

<p><code>port</code> is the port your service listens on inside the cluster. Let's take this example:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: test-service
spec:
  ports:
  - port: 8080
    targetPort: 8070
    nodePort: 31222
    protocol: TCP 
  selector:
    component: test-service-app
</code></pre>

<p>From inside k8s cluster this service will be reachable via <a href="http://test-service.default.svc.cluster.local:8080" rel="nofollow noreferrer">http://test-service.default.svc.cluster.local:8080</a> (service to service communication inside your cluster) and any request reaching there is forwarded to a running pod on targetPort 8070.</p>

<p><code>tagetPort</code> is also by default the same value as port if not specified otherwise.</p>
