title: MiniKubeerror in validating replica set:ValidationError(ReplicaSet.spec.template.metadata):unknown field"spec" in io.k8s.apimachinery.pkg.apis.meta.v1
body: <p>I use minikube and below is the sample Yaml file. I get the below error while try to create the pods.</p>
  
  <pre><code>$ kubectl create -f nginx-rs.yml 
  error: error validating "nginx-rs.yml": error validating data: ValidationError(ReplicaSet.spec.template.metadata): unknown field "spec" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta; if you choose to ignore these errors, turn validation off with --validate=false
  </code></pre>
  
  <p>Here is my YAML file.</p>
  
  <pre><code>apiVersion: apps/v1
  kind: ReplicaSet
  metadata:
    name: nginx-rs
  spec:
    selector:
      matchLabels:
        app: nginx-app
    replicas: 3
    template:
      metadata:
       name: nginx-pod
       labels:
         app: nginx-app
         tier: frontend
       spec:
         containers:
         - name: nginx-container
           image: nginx
           ports:
           - containerport: 80
  </code></pre>
  
  <p>I cross checked my YAML with <a href="https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/" rel="nofollow noreferrer">this tool</a> and everything looks fine.</p>