<p>I am trying to deploy a kubernetes manifest file, but its failing with the below ValidationError</p>

<p>error:</p>

<pre><code>error validating data: ValidationError(Deployment.spec.selector): unknown field "app" in io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector; if you choose to ignore these errors, turn validation off with --validate=false

</code></pre>

<p>Manifest File:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: elastickibana
spec:
  replicas: 1
  selector:
    app: elastickibana
  template:
    metadata:
    spec:
      containers:
      - name: elk
        image: daniccan/kibana-plugin-tester:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 5601
        - containerPort: 9200
        env:
        - name: KIBANA_VERSION
          value: 6.8.2
        - name: PLUGIN_FILE_NAME
          value: kibana-c8-plugin-Alpha-0.0.1-Kibana-6.8.2.zip
        - name: KIBANA_PLUGIN_PATH
          value: /home/sreenivasa/Projects/c8/infrastructure/capsule8-sandbox
---
kind: Service
apiVersion: v1
metadata:
  name: elk-service
  labels:
    app: elk-kibana
spec:
  type: LoadBalancer
  externalIPs:
  - 10.0.2.15
  selector:
    name: elk-kibana
  ports:
  - port: 5601
    name: elasticservice
  ports:
  - port: 9200
    name: serving-http
</code></pre>

<p>Kindly validate if my manifest file is correct and let me know if I miss something. </p>

SREENIVASA REDDY S
<p>You are missing label selectors in your deployment, labels under the template, in the deployment too, and your service label selector should match these labels.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: elastickibana
spec:
  replicas: 1
  selector:
    matchlabels:                     &lt;--missing this
      app: elastickibana
  template:
    metadata:
      labels:                        &lt;--and this
        app: elastickibana
    spec:
      containers:
      - name: elk
        image: daniccan/kibana-plugin-tester:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 5601
        - containerPort: 9200
        env:
        - name: KIBANA_VERSION
          value: 6.8.2
        - name: PLUGIN_FILE_NAME
          value: kibana-c8-plugin-Alpha-0.0.1-Kibana-6.8.2.zip
        - name: KIBANA_PLUGIN_PATH
          value: /home/sreenivasa/Projects/c8/infrastructure/capsule8-sandbox
</code></pre>

<hr>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: elk-service
  labels:
    app: elk-kibana
spec:
  type: LoadBalancer
  externalIPs:
  - 10.0.2.15
  selector:
    app: elastickibana             &lt;--and this should be like this
  ports:
  - port: 5601
    name: elasticservice
  ports:
  - port: 9200
    name: serving-http
</code></pre>

<p>Now, try to do your investigation before posting any questions. These are basics that you would find out by just matching a Deployment and Service examples from the docs. </p>
