<p>I have an application with Pods that are not part of a deployments and I use services like nodePorts I access my application through <strong>ipv4:nodePorts/url-microservice</strong> when I want to scale my pods do I need to have a deployment with replicas?
I tried using deployment with nodePorts but it doesn't work this way anymore: <strong>ipv4:nodePorts/url-microservice</strong></p>
<p>I'll post my deployments and service for someone to see if I'm wrong somewhere</p>
<p>Deployments:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-gateway
  labels:
    app: my-gateway
spec:
  replicas: 1
  selector:
    matchLabels:
      run: my-gateway
  template:
    metadata:
      labels:
        run: my-gateway
    spec:
      containers:
      - name: my-gateway
        image: rafaelribeirosouza86/shopping:api-gateway
        imagePullPolicy: Always
        ports:
        - containerPort: 31534
          protocol: TCP
      imagePullSecrets:
        - name: regcred

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-adm-contact
  labels:
    app: my-adm-contact
spec:
  replicas: 1
  selector:
    matchLabels:
      run: my-adm-contact
  template:
    metadata:
      labels:
        run: my-adm-contact
    spec:
      containers:
      - name: my-adm-contact
        image: rafaelribeirosouza86/shopping:my-adm-contact
        imagePullPolicy: Always
        ports:
        - containerPort: 30001
          protocol: TCP
      imagePullSecrets:
        - name: regcred
</code></pre>
<p>Services:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-adm-contact-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
  ports:
  - port: 30001
    protocol: TCP
    targetPort: 30001
    nodePort: 30001
#  externalTrafficPolicy: Local
  selector:
    app: my-adm-contact
#  type: ClusterIP
#  type: LoadBalancer 
  type: NodePort

---

apiVersion: v1
kind: Service
metadata:
  name:  my-gateway-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 31534
    protocol: TCP
    targetPort: 31534
    nodePort: 31534
#  externalTrafficPolicy: Local
  selector:
    app: my-gateway
#  type: ClusterIP
#  type: LoadBalancer 
  type: NodePort
</code></pre>

Rafael Souza
<p>Try:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-gateway
  ...
spec:
  ...
  template:
    metadata:
      labels:
        run: my-gateway  # &lt;-- take note
  ...
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-adm-contact
  ...
spec:
  ...
  template:
    metadata:
      labels:
        run: my-adm-contact  # &lt;-- take note
  ...
---
apiVersion: v1
kind: Service
metadata:
  name: my-adm-contact-service
  ...
  selector:
    run: my-adm-contact  # &lt;-- wrong selector, changed from 'app' to 'run'
---
apiVersion: v1
kind: Service
metadata:
  name:  my-gateway-service
  ...
  selector:
    run: my-gateway  # &lt;-- wrong selector, changed from 'app' to 'run'
</code></pre>
