title: kubectl apply -f k8s: is unable to recognize service and deployment and has no matches for kind "Service" in version "v1"
body: <p>I have kubernetes running on OVH without a problem. But i recently reinstalled the build server because of other issues and setup everything but when trying to apply files it gives this horrable error.. did i miss something? and what does this error really mean?</p>
  
  <pre class="lang-sh prettyprint-override"><code>+ kubectl apply -f k8s
  unable to recognize "k8s/driver-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
  unable to recognize "k8s/driver-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
  unable to recognize "k8s/driver-mysql-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
  unable to recognize "k8s/driver-mysql-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
  unable to recognize "k8s/driver-mysql-persistent-volume-claim.yaml": no matches for kind "PersistentVolumeClaim" in version "v1"
  unable to recognize "k8s/driver-phpmyadmin-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
  unable to recognize "k8s/driver-phpmyadmin-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
  </code></pre>
  
  <p>I tried all previous answes on SO but none worked out for me. I don't think that i really need it, "correct me if i am wrong on that". I really would like to get some help with this.</p>
  
  <p>I have installed kubectl and i got a config file that i use.
  And when i execute the <code>kubectl get pods</code> command i am getting the pods that where deployed before </p>
  
  <p>These are some of the yml files </p>
  
  <blockquote>
    <p><em>k8s/driver-cluster-ip-service.yaml</em></p>
  </blockquote>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: driver-cluster-ip-service
  spec:
    type: ClusterIP
    selector:
      component: driver-service
    ports:
      - port: 3000
        targetPort: 8080
  
  </code></pre>
  
  <blockquote>
    <p><em>k8s/driver-deployment.yaml</em></p>
  </blockquote>
  
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: driver-deployment
  spec:
    replicas: 1
    selector:
      matchLabels:
        component: driver-service
    template:
      metadata:
        labels:
          component: driver-service
      spec:
        containers:
          - name: driver
            image: repo.taxi.com/driver-service
            imagePullPolicy: Always
            ports:
              - containerPort: 8080
        imagePullSecrets:
          - name: taxiregistry
  </code></pre>
  
  <blockquote>
    <p><em>dockerfile</em></p>
  </blockquote>
  
  <pre><code>FROM maven:3.6.0-jdk-8-slim AS build
  COPY . /home/app/
  RUN rm /home/app/controllers/src/main/resources/application.properties
  RUN mv /home/app/controllers/src/main/resources/application-kubernetes.properties /home/app/controllers/src/main/resources/application.properties
  RUN mvn -f /home/app/pom.xml clean package
  
  FROM openjdk:8-jre-slim
  COPY --from=build /home/app/controllers/target/controllers-1.0.jar /usr/local/lib/driver-1.0.0.jar
  EXPOSE 8080
  ENTRYPOINT ["java","-jar","/usr/local/lib/driver-1.0.0.jar"]
  </code></pre>
  
  <p><code>kubectl get pods command</code>
  <a href="https://i.stack.imgur.com/3I2cy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3I2cy.png" alt="get pods"></a></p>
  
  <p><code>kubectl api-versions</code></p>
  
  <p><a href="https://i.stack.imgur.com/Kh54A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kh54A.png" alt="api-versions"></a></p>