<p>I would like to confirm whether we can expose service without having  container port in the pod. In the below example, pod don't have container port but service is having port defined:</p>
<pre><code>apiVersion: v1
metadata:
name: mypod
namespace: ggckad-s8
labels:
 app: mypod
spec:
 volumes:
- name: log-volume
  emptyDir: {}
 containers:
  - name: app
    image: kubegoldenguide/question-29-app
    volumeMounts:
    - name: log-volume
      mountPath: /var/log
</code></pre>
<hr />
<pre><code>kind: Service
apiVersion: v1
metadata:
name: mypod-service
namespace: ggckad-s8
spec:
  type: NodePort
  selector: 
     app: mypod
   ports: 
   - port: 8000
</code></pre>

<p>Yes you can expose service without having container port in the pod. The default port of container will be exposed for service. List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default &quot;0.0.0.0&quot; address inside a container will be accessible from the network.</p>
<p>For more info have look at the docs <a href="https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service</a></p>
