d3vpasha
d3vpasha

Reputation: 528

Trying to deploy traefik with kubernetes

I'm trying to deploy traefik in Kubernetes with minikube. The deployment works well, the pod starts but when I look into pod logs, I get this :

Failed to list *v1beta1.Ingress: the server could not find the requested resource (get ingresses.extensions)

My current kubectl & kubernetes server versions are :

kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.1", GitCommit:"632ed300f2c34f6d6d15ca4cef3d3c7073412212", GitTreeState:"clean", BuildDate:"2021-08-19T15:45:37Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.1", GitCommit:"632ed300f2c34f6d6d15ca4cef3d3c7073412212", GitTreeState:"clean", BuildDate:"2021-08-19T15:39:34Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"

The version of traefik image that I try to deploy : traefik:v2.0

I set up all the RBAC resources and my current configuration for traefik is :

apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  name: traefik-lb
spec:
  controller: traefik.io/ingress-controller
---
apiVersion: "networking.k8s.io/v1"
kind: "Ingress"
metadata:
  name: "example-ingress"
spec:
  ingressClassName: "traefik-lb"
  rules:
  - host: "*.example.com"
    http:
      paths:
      - path: "/example"
        pathType: Exact
        backend:
          service:
            name: "rabbitmq"
            port:
                number: 32666
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: traefik-ingress-controller
rules:
  - apiGroups: [""]
    resources: [services, endpoints]
    verbs: [list, watch]
  - apiGroups: [extensions]
    resources: [ingresses]
    verbs: [list]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: traefik-ingress-controller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: traefik-ingress-controller
subjects:
- kind: ServiceAccount
  name: {{ include "traefik.serviceAccountName" . }}
  namespace: default

The command api-versions result :

d3vpasha@d3vpasha-ZenBook-UX425EA-UX425EA ~/helm-charts/charts/traefik (dev)$ kubectl api-versions
admissionregistration.k8s.io/v1
apiextensions.k8s.io/v1
apiregistration.k8s.io/v1
apps/v1
authentication.k8s.io/v1
authorization.k8s.io/v1
autoscaling/v1
autoscaling/v2beta1
autoscaling/v2beta2
batch/v1
batch/v1beta1
certificates.k8s.io/v1
coordination.k8s.io/v1
discovery.k8s.io/v1
discovery.k8s.io/v1beta1
events.k8s.io/v1
events.k8s.io/v1beta1
flowcontrol.apiserver.k8s.io/v1beta1
networking.k8s.io/v1
node.k8s.io/v1
node.k8s.io/v1beta1
policy/v1
policy/v1beta1
rbac.authorization.k8s.io/v1
scheduling.k8s.io/v1
storage.k8s.io/v1
storage.k8s.io/v1beta1
v1

I don't see what I do wrong :/ if someone can help me, thank you in advance

EDIT : I would like to add the fact that traefik:2.5 has not this problem so it's something related to the version 2.0 of traefik...

Upvotes: 1

Views: 2602

Answers (1)

codeaprendiz
codeaprendiz

Reputation: 3195

You might want to look at a lot of examples that I have done for the same here

Try this. You might need to change the service type from LoadBalancer to ClusterIP.

This might help as well traefik-whoami

Try using helm for generating resources. Its much more convenient to manage. You can always generate the k8s-manifests if something is wrong.

Upvotes: 1

Related Questions