<p>I made a customer-pod (including image with a spring boot application running on port 8080).</p>

<p>** On the yaml file, I didnt explicitly write container port number like spec:containers:port:8080.</p>

<pre><code>kind: Pod  
apiVersion: v1
metadata:
name: customer-pod
spec:
  containers:
    - name: customer-pod
      image: docker.temp.com/customer-service:8
</code></pre>

<p>I can check it with "$ kubectl get pods commands -o wide"</p>

<p>===========================================</p>

<p>NAME                                        READY     STATUS    RESTARTS   AGE       IP            NODE</p>

<p>customer-pod                                1/1       Running   0          43m       10.43.1.17    default</p>

<p>===========================================</p>

<p>After that, </p>

<p>$ curl 10.43.1.17:8080<br>
{"timestamp":"2018-08-22T05:58:58.938+0000","status":404,"error":"Not Found","message":"No message available","path":"/"}</p>

<p>I wonder how I can access the customer port(8080) without port open.<br>
In case of Docker, I know that I should explicitly write a port in the run command to connect it.<br>
In Kubernetes, are ports automatically open?</p>

<p>You do not open port in kubernetes. By default, all pods can communicate to each other, in most setups also node-to-port will be allowed. Refering to Docker you mean the port mapping <code>-p</code> option, which also is not port opening (you can access docker container ports if you use container IP even if not mapped to expose outside of container).</p>

<p>If you want to restrict cross-pod networking you need to use <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/" rel="nofollow noreferrer">Network Policies</a> and networking solution capable of enforcing them.</p>
