<p>I am trying to connect a k8s deployment to a (Oracle DB) deployment/service. Here is my DB deployment and service:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: oracle-db
  labels:
    app: oracle-db
spec:
  ports:
  - name: oracle-db
    port: 1521
    protocol: TCP
    targetPort: 1521
  selector:
    app: oracle-db
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: oracle-db-depl
  labels:
    app: oracle-db
spec:
  selector:
    matchLabels:
      app: oracle-db
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: oracle-db
    spec:
      containers:
      - name: oracle-db
        image: oracledb:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 1521
        env:
          ...
</code></pre>

<p>I'm wondering in the labels sections, what exactly is the difference between specifying 'run' vs 'app' (both of which I have seen used). I have scoured the k8s documentation and cannot find an answer.</p>

user1394
<p>Labels are arbitrary key value pairs. There is no special meaning of <code>app</code> or <code>run</code>. You can choose any key and value for your labels. One thing to remember though is that the <strong>service's selector needs to have a label which matches with what has been specified as label on the deployment otherwise it will not work</strong>.</p>

<p>So if you have <code>app: oracle-db</code> label in your deployment then have <code>app: oracle-db</code> in service's selector and if you have <code>run: oracle-db</code> label in your deployment then have <code>run: oracle-db</code> in service's selector.</p>
