<p>I want to deploy a custom nginx app on my kubernetes cluster.</p>

<p>I have three raspberry in a cluster. My deplotment file looks as follows </p>

<pre><code>kubepodDeploy.yaml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      run: my-nginx
  replicas: 2
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image:   privateRepo/my-nginx
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: my-nginx
  labels:
    run: my-nginx
spec:
  type: NodePort 
  ports:
  - port: 8080
    targetPort: 80
    protocol: TCP
    name: http
  - port: 443
    protocol: TCP
    name: https
  selector:
    run: my-nginx
</code></pre>

<p>How can I deploy it so that I can access my app by ipadress. Which service type do I need?  </p>

<p>my service details are: </p>

<pre><code>kubectl describe service my-nginx                                                                                                                           ~/Project/htmlBasic
Name:                     my-nginx
Namespace:                default
Labels:                   run=my-nginx
Annotations:              Selector:  run=my-nginx
Type:                     NodePort
IP:                       10.99.107.194
Port:                     http  8080/TCP
TargetPort:               80/TCP
NodePort:                 http  30488/TCP
Endpoints:                10.32.0.4:80,10.32.0.5:80
Port:                     https  443/TCP
TargetPort:               443/TCP
NodePort:                 https  32430/TCP
Endpoints:                10.32.0.4:443,10.32.0.5:443
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>

A.Dumas
<p>You can not access the application on  ipaddress:8080 without using a proxy server in front or changing IPtable rules(not good idea). NodePort service type will always expose service in port range 30000-32767</p>

<p>So at any point, your service will be running on ipaddress:some_higher_port</p>

<p>Running a  proxy in front which, redirects the traffic to node port and since 8080 is your requirement so run proxy server also on 8080 port.</p>

<p>Just to add proxy server will not be part of Kubernetes  cluster</p>

<p>If you are on cloud consider using LoadBalancer service and access you app on some DNS name.</p>
