kubernetes - 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...
解决方案
你可能想看看我在这里做的很多例子
试试这个。您可能需要将服务类型从 LoadBalancer 更改为 ClusterIP。
这可能也有帮助traefik-whoami
尝试使用 helm 生成资源。管理起来更方便。如果出现问题,您始终可以生成 k8s 清单。
推荐阅读
- python - python - 避免for循环中不必要的重复
- jquery - 如何使用 jquery 或 css 在引导程序中使可拖动弹出?
- java - 在 Java Web 应用程序中启用 NTLM 后出现错误 - Ubuntu 18.04
- acumatica - 为什么我的选择器没有在我的自定义屏幕中选择记录?我错过了什么吗?Acumatica
- ios - 在转换为长目标 -C 时获取垃圾值
- mysql - 人的年龄计算
- angular - 在定义组合的 observables 之前分配它们的结果
- ruby-on-rails - 如何将数组的值存储在 ruby on rails 的表中?
- php - 使用带有 php 和 mysqli 的 spout 库导出 excel 花费的时间太长?
- javascript - 使用 Firefox Web-Extension 检索或流式传输所有历史记录