<p>I'm getting the following error when running <code>skaffold dev</code> on my microservices project.  I literally taken the code straight out of a tutorial on microservices, but am still getting the error:</p>
<pre><code>The Deployment &quot;orders-mongo-depl&quot; is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{&quot;app&quot;:&quot;orders-mongo&quot;}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
kubectl apply: exit status 1
</code></pre>
<p>Here is my &quot;orders-mongo-depl.yaml&quot; file</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: orders-mongo-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: orders-mongo
  template:
    metadata:
      labels:
        app: orders-mongo
    spec:
      containers:
        - name: orders-mongo
          image: mongo
---
apiVersion: v1
kind: Service
metadata:
  name: orders-mongo-srv
spec:
  selector:
    app: orders-mongo
  ports:
    - name: db
      protocol: TCP
      port: 27017
      targetPort: 27017
</code></pre>
<p>Here is my skaffold.yaml file</p>
<pre><code>apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: stephengrider/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
    - image: stephengrider/client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '**/*.js'
            dest: .
    - image: stephengrider/tickets
      context: tickets
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
    - image: stephengrider/orders
      context: orders
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
</code></pre>
<p>I have tried restarting skaffold, deleting and restarting Minikube, changing the minikube driver between virtualbox and docker, and restarting my computer.  I am on the latest version of ubuntu and have up to date minikube, kubernetes and docker.</p>

Patrick Gorman
<p>Posting this as an answer out of comments since it resolved the issue.</p>
<p><strong>Short answer</strong></p>
<p>To cleanup all deployments and objects, following command should be issued:</p>
<p><code>skaffold delete</code></p>
<p><strong>A bit more details</strong></p>
<p>During development and testing objects are created. When any changes are done within the config or objects itself, error is fired e.g.</p>
<pre><code>The Deployment &quot;orders-mongo-depl&quot; is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{&quot;app&quot;:&quot;orders-mongo&quot;}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
</code></pre>
<p>Short test in kubernetes showed that changing <code>selector</code> in service or development producing exactly the same error which leads to necessity to correct manifest/objects or reset deployments in <code>skaffold</code> if not clear where discrepancy comes from.</p>
<p><a href="https://skaffold.dev/docs/tutorials/artifact-dependencies/#cleanup" rel="nofollow noreferrer">Skaffold cleanup reference</a></p>
