<p>I have a question about the usage of apiVersion in Kuberntes. </p>

<p>For example I am trying to deploy traefik 2.2.1 into my kubernetes cluster. I have a traefik middleware deployment definition like this:</p>

<pre><code>---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: https-redirect
spec:
  redirectScheme:
    scheme: https
    permanent: true
    port: 443
</code></pre>

<p>When I try to deploy my objects with </p>

<pre><code>$ kubectl apply -f middleware.yaml
</code></pre>

<p>I got the following error message:</p>

<pre><code>unable to recognize "middleware.yaml": no matches for kind "Middleware" in version "traefik.containo.us/v1alpha1"
</code></pre>

<p>The same object works fine with Traefik version 2.2.0 but not with version 2.2.1. </p>

<p>On the traefik documentation there is no example other the ones using the version "traefik.containo.us/v1alpha1"</p>

<p>I dont't hink that my deployment issue is specific to traefik. It is a general problem with conflicting versions. Is there any way how I can figure out which apiVersions are supported in my cluster environment?</p>

<p>There are so many outdated examples posted around using deprecated apiVersions that I wonder if there is some kind of official apiVersion directory for kubernetes? Or maybe there is some kubectl command which I can ask for apiversions?</p>

Ralph
<p>Most probably crds for traefik v2 are not installed. You could use below command which lists the API versions that are available on the Kubernetes cluster.</p>

<pre><code>kubectl api-versions | grep traefik
traefik.containo.us/v1alpha1
</code></pre>

<p>Use below command to check crds installed on the Kubernetes cluster.</p>

<pre><code>kubectl get crds
NAME                                   CREATED AT
ingressroutes.traefik.containo.us      2020-05-09T13:58:09Z
ingressroutetcps.traefik.containo.us   2020-05-09T13:58:09Z
ingressrouteudps.traefik.containo.us   2020-05-09T13:58:09Z
middlewares.traefik.containo.us        2020-05-09T13:58:09Z
tlsoptions.traefik.containo.us         2020-05-09T13:58:09Z
tlsstores.traefik.containo.us          2020-05-09T13:58:09Z
traefikservices.traefik.containo.us    2020-05-09T13:58:09Z
</code></pre>

<p>Check traefik v1 vs v2 <a href="https://docs.traefik.io/migration/v1-to-v2/" rel="noreferrer">here</a></p>
