How to configure middleware with kubernetes-ingress? (middleware "xyz" does not exist)

Yes, that's right. In your case, the middleware would be called: default-path-prefix@kubernetescrd

But to be honest. So far I could only access the middlewares via annotations in an ingress object. I also tried using the CLI arguments, because I wanted to configure a default middleware for my entry point.

- --entrypoints.traefik.Address=:8080
- --entrypoints.traefik.http.middlewares=ingress-traefik-traefik-api-auth@kubernetescrd

But in this case I got the same error message as you. I really think this is a bug in Traefik.

Someone else has the same problem here: 2.2 can't see Kubernetes defined entryPoint middlewares? - Traefik v2 (latest) - Traefik Labs Community Forum

So I really don't think that this function works properly yet.