<p>I am trying to setup traefik ingress route using the configuration that is provided at <a href="https://docs.traefik.io/routing/providers/kubernetes-crd/" rel="noreferrer">https://docs.traefik.io/routing/providers/kubernetes-crd/</a></p>
<p>I can see traefik is up &amp; running, can also see the dashboard. But I dont see the whoami service on dashboard and cannot access it via url.</p>
<p><a href="https://i.stack.imgur.com/xwqcZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xwqcZ.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/WQjb4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WQjb4.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/qajbN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qajbN.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/BeDzU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BeDzU.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/raFCQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/raFCQ.png" alt="enter image description here" /></a></p>
<p><strong>crd.yaml</strong></p>
<pre><code># All resources definition must be declared
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: ingressroutes.traefik.containo.us

spec:
  group: traefik.containo.us
  version: v1alpha1
  names:
    kind: IngressRoute
    plural: ingressroutes
    singular: ingressroute
  scope: Namespaced

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: middlewares.traefik.containo.us

spec:
  group: traefik.containo.us
  version: v1alpha1
  names:
    kind: Middleware
    plural: middlewares
    singular: middleware
  scope: Namespaced

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: ingressroutetcps.traefik.containo.us

spec:
  group: traefik.containo.us
  version: v1alpha1
  names:
    kind: IngressRouteTCP
    plural: ingressroutetcps
    singular: ingressroutetcp
  scope: Namespaced

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: ingressrouteudps.traefik.containo.us

spec:
  group: traefik.containo.us
  version: v1alpha1
  names:
    kind: IngressRouteUDP
    plural: ingressrouteudps
    singular: ingressrouteudp
  scope: Namespaced

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: tlsoptions.traefik.containo.us

spec:
  group: traefik.containo.us
  version: v1alpha1
  names:
    kind: TLSOption
    plural: tlsoptions
    singular: tlsoption
  scope: Namespaced

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: tlsstores.traefik.containo.us

spec:
  group: traefik.containo.us
  version: v1alpha1
  names:
    kind: TLSStore
    plural: tlsstores
    singular: tlsstore
  scope: Namespaced

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: traefikservices.traefik.containo.us

spec:
  group: traefik.containo.us
  version: v1alpha1
  names:
    kind: TraefikService
    plural: traefikservices
    singular: traefikservice
  scope: Namespaced
</code></pre>
<p><strong>ingress.yaml</strong></p>
<pre><code>apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: myingressroute
  namespace: default
  annotations:
    kubernetes.io/ingress.class: traefik

  spec:
    entryPoints:
      - web

    routes:
      - match: Host(`test`) &amp;&amp; PathPrefix(`/bar`)
        kind: Rule
        services:
        - name: whoami
          port: 80
</code></pre>
<p><strong>rbac.yaml</strong></p>
<pre><code>kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: traefik-ingress-controller

rules:
  - apiGroups:
      - &quot;&quot;
    resources:
      - services
      - endpoints
      - secrets
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - extensions
    resources:
      - ingresses
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - extensions
    resources:
      - ingresses/status
    verbs:
      - update
  - apiGroups:
      - traefik.containo.us
    resources:
      - middlewares
      - ingressroutes
      - traefikservices
      - ingressroutetcps
      - ingressrouteudps
      - tlsoptions
      - tlsstores
    verbs:
      - get
      - list
      - watch

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: traefik-ingress-controller

roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: traefik-ingress-controller
subjects:
  - kind: ServiceAccount
    name: traefik-ingress-controller
    namespace: default
</code></pre>
<p><strong>traefik.yaml</strong></p>
<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
  name: traefik-ingress-controller

---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: traefik
  labels:
    app: traefik

spec:
  replicas: 1
  selector:
    matchLabels:
      app: traefik
  template:
    metadata:
      labels:
        app: traefik
    spec:
      serviceAccountName: traefik-ingress-controller
      containers:
        - name: traefik
          image: traefik:v2.2
          args:
            - --log.level=DEBUG
            - --api
            - --api.insecure
            - --entrypoints.web.address=:80
            - --providers.kubernetescrd
          ports:
            - name: web
              containerPort: 80
            - name: admin
              containerPort: 8080

---
apiVersion: v1
kind: Service
metadata:
  name: traefik
spec:
  type: LoadBalancer
  selector:
    app: traefik
  ports:
    - protocol: TCP
      port: 80
      name: web
      targetPort: 80
    - protocol: TCP
      port: 8080
      name: admin
      targetPort: 8080
</code></pre>
<p><strong>whoami.yaml</strong></p>
<pre><code>kind: Deployment
apiVersion: apps/v1
metadata:
  name: whoami
  namespace: default
  labels:
    app: containous
    name: whoami

spec:
  replicas: 1
  selector:
    matchLabels:
      app: containous
      task: whoami
  template:
    metadata:
      labels:
        app: containous
        task: whoami
    spec:
      containers:
        - name: containouswhoami
          image: containous/whoami
          ports:
            - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: whoami
  namespace: default

spec:
  ports:
    - name: http
      port: 80
  selector:
    app: containous
    task: whoami


</code></pre>
<p><strong>UPDATE</strong>
After resources from link</p>
<p><a href="https://i.stack.imgur.com/qnyV4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qnyV4.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/U5lZp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/U5lZp.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/EFnOa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EFnOa.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/eOvfe.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eOvfe.png" alt="enter image description here" /></a></p>
<pre><code>E0708 21:34:10.222538       1 reflector.go:153] pkg/mod/k8s.io/client-go@v0.17.3/tools/cache/reflector.go:105: Failed to list *v1alpha1.IngressRouteUDP: ingressrouteudps.traefik.containo.us is forbidden: User &quot;system:serviceaccount:default:traefik-ingress-controller&quot; cannot list resource &quot;ingressrouteudps&quot; in API group &quot;traefik.containo.us&quot; at the cluster scope
E0708 21:34:10.223416       1 reflector.go:153] pkg/mod/k8s.io/client-go@v0.17.3/tools/cache/reflector.go:105: Failed to list *v1alpha1.TLSStore: tlsstores.traefik.containo.us is forbidden: User &quot;system:serviceaccount:default:traefik-ingress-controller&quot; cannot list resource &quot;tlsstores&quot; in API group &quot;traefik.containo.us&quot; at the cluster scope
E0708 21:34:11.225368       1 reflector.go:153] pkg/mod/k8s.io/client-go@v0.17.3/tools/cache/reflector.go:105: Failed to list *v1alpha1.TLSStore: tlsstores.traefik.containo.us is forbidden: User &quot;system:serviceaccount:default:traefik-ingress-controller&quot; cannot list resource &quot;tlsstores&quot; in API group &quot;traefik.containo.us&quot; at the cluster scope

</code></pre>

<p>Its working for me with with treafik 2.1 using following set of resources.</p>
<p><a href="https://github.com/codeaprendiz/kubernetes-kitchen/tree/master/gcp/task-005-traefik-whoami" rel="nofollow noreferrer">link to example</a></p>
<p>Can you try these once and let me know if this helps.</p>
