<p>I want to deploy frontend and backend applications on kubernetes. I write yaml files(i get this from helm temlate): </p>

<pre><code># Source: quality-control/templates/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: RELEASE-NAME-quality-control
  labels:
    app.kubernetes.io/name: quality-control
    helm.sh/chart: quality-control-0.1.0
    app.kubernetes.io/instance: RELEASE-NAME
    app.kubernetes.io/managed-by: Tiller
spec:
  rules:
    - host: "quality-control.ru"
      http:
        paths:
          - path: /
            backend:
              serviceName: RELEASE-NAME-quality-control
              servicePort: http

---
# Source: quality-control/templates/deployment.yaml
apiVersion: apps/v1beta2
kind: List
items:
- apiVersion: apps/v1beta2
  kind: Deployment
  metadata:
    name: quality-control-frontend
    labels:
      app.kubernetes.io/name: quality-control-frontend
      helm.sh/chart: quality-control-0.1.0
      app.kubernetes.io/instance: RELEASE-NAME
      app.kubernetes.io/managed-by: Tiller
  spec:
    replicas: 1
    selector:
    matchLabels:
      app.kubernetes.io/name: quality-control-frontend
      app.kubernetes.io/instance: RELEASE-NAME
    template:
      metadata:
        labels:
          app.kubernetes.io/name: quality-control-frontend
          app.kubernetes.io/instance: RELEASE-NAME
        logger: external
        sourcetype: quality-control-frontend
      spec:
        containers:
          - name: quality-control
            image: "registry.***.ru:5050/quality-control-frontend:stable"
            imagePullPolicy: Always
            env:
            - name: spring_profiles_active
              value: dev

            ports:
              - containerPort: 80
                protocol: TCP
                livenessProbe:
                  httpGet:
                    path: /healthcheck
                    port: 80
                    protocol: TCP
                  initialDelaySeconds: 10
                  periodSeconds: 10
            resources:
            limits:
              cpu: 2
              memory: 2048Mi
            requests:
              cpu: 1
              memory: 1024Mi

- apiVersion: apps/v1beta2
  kind: Deployment
  metadata:
    name: quality-control-backend
    labels:
      app.kubernetes.io/name: quality-control-backend
      helm.sh/chart: quality-control-0.1.0
      app.kubernetes.io/instance: RELEASE-NAME
      app.kubernetes.io/managed-by: Tiller
  spec:
    replicas: 1
    selector:
      matchLabels:
        app.kubernetes.io/name: quality-control-backend
        app.kubernetes.io/instance: RELEASE-NAME
    template:
      metadata:
        labels:
          app.kubernetes.io/name: quality-control-backend
          app.kubernetes.io/instance: RELEASE-NAME
          logger: external
          sourcetype: quality-control-backend
      spec:
        containers:
          - name: quality-control
            image: "registry.***.ru:5050/quality-control-backend:stable"
            imagePullPolicy: Always
            env:
            - name: spring_profiles_active
              value: dev

            ports:
              - containerPort: 80
                protocol: TCP
                resources:
            limits:
              cpu: 2
              memory: 2048Mi
            requests:
              cpu: 1
              memory: 1024Mi


---
# Source: quality-control/templates/service.yaml
apiVersion: v1
kind: List
items:
  - apiVersion: v1
    kind: Service
    metadata:
      name: quality-control-frontend
      labels:
        app.kubernetes.io/name: quality-control-frontend
        helm.sh/chart: quality-control-0.1.0
        app.kubernetes.io/instance: RELEASE-NAME
        app.kubernetes.io/managed-by: Tiller
    spec:
      type: ClusterIP
      ports:
      - port: 80
        targetPort: 80
        protocol: TCP
      selector:
        app.kubernetes.io/name: quality-control-frontend
        app.kubernetes.io/instance: RELEASE-NAME

  - apiVersion: v1
    kind: Service
    metadata:
    name: quality-control-backend
    labels:
        app.kubernetes.io/name: quality-control-backend
        helm.sh/chart: quality-control-0.1.0
        app.kubernetes.io/instance: RELEASE-NAME}
        app.kubernetes.io/managed-by: Tiller
    spec:
      type: ClusterIP
      ports:
        - port: 8080
          targetPort: 8080
          protocol: TCP
      selector:
        app.kubernetes.io/name: quality-control-backend
        app.kubernetes.io/instance: RELEASE-NAME
</code></pre>

<p>But I get an error when deploying: </p>

<pre><code>Error: release quality-control failed: Deployment.apps "quality-control-frontend" is invalid: [spec.selector: Required value, spec.template.metadata.la                             bels: Invalid value: map[string]string{"app.kubernetes.io/instance":"quality-control", "app.kubernetes.io/name":"quality-control-frontend"}: `selector`                              does not match template `labels`]
</code></pre>

Nikolay
<p>There is a indent issue in first deployment object</p>

<p>change it from</p>

<pre><code>spec:
    replicas: 1
    selector:
    matchLabels:
      app.kubernetes.io/name: quality-control-frontend
      app.kubernetes.io/instance: RELEASE-NAME
</code></pre>

<p>to</p>

<pre><code>spec:
    replicas: 1
    selector:
      matchLabels:
        app.kubernetes.io/name: quality-control-frontend
        app.kubernetes.io/instance: RELEASE-NAME
</code></pre>

<p>Also there is indent problem in service list, need to change it from</p>

<pre><code>- apiVersion: v1
    kind: Service
    metadata:
    name: quality-control-backend
    labels:
        app.kubernetes.io/name: quality-control-backend
        helm.sh/chart: quality-control-0.1.0
        app.kubernetes.io/instance: RELEASE-NAME}
        app.kubernetes.io/managed-by: Tiller
</code></pre>

<p>to</p>

<pre><code>- apiVersion: v1
    kind: Service
    metadata:
      name: quality-control-backend
      labels:
        app.kubernetes.io/name: quality-control-backend
        helm.sh/chart: quality-control-0.1.0
        app.kubernetes.io/instance: RELEASE-NAME
        app.kubernetes.io/managed-by: Tiller
</code></pre>
