<p>I have two <code>kind: Deployment</code> in my <code>yaml</code> file
The main one</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: accounts-management-service
  labels:
    app: accounts-management-service
spec:
  replicas: $($env:WEB_REPLICAS)
  selector:
    matchLabels:
      app: accounts-management-service
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 20%
      maxUnavailable: 10%
  progressDeadlineSeconds: 3600
  template:
    metadata:
      labels:
        app: accounts-management-service
    spec:
      containers:
        - image: registry$(GetHash).azurecr.io/$(GetContext 'ApplicationContainerName')
          name: accounts-management-service
          command: [&quot;npm&quot;]
          args: [&quot;run&quot;, &quot;start:production:web&quot;]
          resources:
            requests:
              memory: &quot;500Mi&quot;
              cpu: &quot;1000m&quot;
            limits:
              memory: &quot;4096Mi&quot;
              cpu: &quot;1001m&quot;
          env:
            - name: CONFIG_DEPLOYMENT_UNIT
              value: $(GetContext 'DeploymentUnit')
            - name: NODE_ENV
              value: $(GetContext 'DeploymentUnit')
            - name: TENANT
              value: &quot;$(GetContext 'DeploymentUnit' | Format -NoHyphens)$(GetContext 'Cluster')&quot;
            - name: ROLE
              value: $(GetContext 'Cluster')
          ports:
            - containerPort: 1337
              protocol: TCP
          volumeMounts:
            - name: secret-agent
              mountPath: /var/run/secret-agent
          readinessProbe:
            httpGet:
              path: /v0.1/status
              port: 1337
            successThreshold: 2
            failureThreshold: 3
            initialDelaySeconds: 60
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: /v0.1/status_without_db
              port: 1337
            failureThreshold: 3
            initialDelaySeconds: 60
            periodSeconds: 30
      volumes:
        - name: secret-agent
          hostPath:
            path: /var/run/secret-agent
            type: DirectoryOrCreate
</code></pre>
<p>and the second one</p>
<pre><code># second
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: accounts-management-service-second
  labels:
    app: accounts-management-service-second
spec:
  replicas: $($env:second_REPLICAS)
  selector:
    matchLabels:
      app: accounts-management-service-second
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 10%
      maxUnavailable: 10%
  template:
    metadata:
      labels:
        app: accounts-management-service-second
    spec:
      containers:
        - image: registry$(GetHash).azurecr.io/$(GetContext 'ApplicationContainerName')
          name: accounts-management-service-second
          command: [&quot;npm&quot;]
          args: [&quot;run&quot;, &quot;start:production:second&quot;]
          resources:
            requests:
              memory: &quot;500Mi&quot;
              cpu: &quot;250m&quot;
            limits:
              memory: &quot;8192Mi&quot;
              cpu: &quot;1001m&quot;
          env:
            - name: CONFIG_DEPLOYMENT_UNIT
              value: $(GetContext 'DeploymentUnit')
            - name: NODE_ENV
              value: $(GetContext 'DeploymentUnit')
            - name: TENANT
              value: &quot;$(GetContext 'DeploymentUnit' | Format -NoHyphens)$(GetContext 'Cluster')&quot;
            - name: ROLE
              value: $(GetContext 'Cluster')
          ports:
            - containerPort: 1337
              protocol: TCP
          volumeMounts:
            - name: secret-agent
              mountPath: /var/run/secret-agent
          readinessProbe:
            httpGet:
              path: /status
              port: 1337
            initialDelaySeconds: 60
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: /status
              port: 1337
            initialDelaySeconds: 60
            periodSeconds: 10
      volumes:
        - name: secret-agent
          hostPath:
            path: /var/run/secret-agent
            type: DirectoryOrCreate
</code></pre>
<p>They both point to the same volume path. I am new to Kubernetes and I am trying to understand the relation between pod creation and two <code>kind: Deployment</code>s. It would be nice if someone can explain thos. I hope that this falls into the SO allowed questions category.</p>

MikiBelavista
<p>If you want to figure out which pods were created by specified deployment, you could use <code>kubectl get pods</code> command with <code>--selector</code> option to filter these pods.</p>
<p>The labels you defined in deployment templates were <code>app=accounts-management-service</code> and <code>app=accounts-management-service-second</code>, you could figure out these pods by:</p>
<pre><code>$ kubectl get pods --selector=app=accounts-management-service
$ kubectl get pods --selector=app=accounts-management-service-second
</code></pre>
