我部署了traefik ingress controller
pod和两个服务,其中一个是LoadBalancer
类型的反向代理,另一个是ClusterIP
类型的 Jmeter 板。
我还创建了一个入口,将所有的<elb-address>/dashboard
重定向到我的traefik Jmeter 板。
但由于某种原因,当我试图在aws-ip/dashboard
请求我的 Jmeter 板时,我得到了404错误代码
这是我用来设置traefik的清单yamls
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
namespace: kube-system
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: traefik-ingress-controller
namespace: kube-system
labels:
k8s-app: traefik-ingress-lb
spec:
replicas: 1
selector:
matchLabels:
k8s-app: traefik-ingress-lb
template:
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
spec:
serviceAccountName: traefik-ingress-controller
terminationGracePeriodSeconds: 60
containers:
- image: traefik
name: traefik-ingress-lb
ports:
- name: http
containerPort: 80
- name: admin
containerPort: 8080
args:
- --api
- --kubernetes
- --logLevel=INFO
---
kind: Service
apiVersion: v1
metadata:
name: traefik-ingress-service
namespace: kube-system
spec:
selector:
k8s-app: traefik-ingress-lb
ports:
- protocol: TCP
targetPort: 80
port: 80
type: LoadBalancer
---
kind: Service
apiVersion: v1
metadata:
name: traefik-web-ui
namespace: kube-system
spec:
selector:
k8s-app: traefik-ingress-lb
ports:
- name: web
port: 80
targetPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: kube-system
name: traefik-ingress
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- http:
paths:
- path: /dashboard
backend:
serviceName: traefik-web-ui
servicePort: web
更新
我正在查看日志,并在激活rbac并创建ClusterRole、ServiceRole和ServiceAccount时出现以下错误:
E1124 18:56:23.267560 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Endpoints: endpoints is forbidden: User "system:serviceaccount:kube-system:traefik-ingress" cannot list endpoints in the namespace "default"
E1124 18:56:23.648207 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Service: services is forbidden: User "system:serviceaccount:kube-system:traefik-ingress" cannot list services in the namespace "default"
E1124 18:56:23.267560 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Endpoints: endpoints is forbidden: User "system:serviceaccount:kube-system:traefik-ingress" cannot list endpoints in the namespace "default"
这是我的serviceAccount、clusterRole和RoleBingind
kind: ServiceAccount
apiVersion: v1
metadata:
name: traefik-ingress
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: traefik-ingress
rules:
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- ingresses/status
verbs:
- update
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: traefik-ingress
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: traefik-ingress
subjects:
- kind: ServiceAccount
name: traefik-ingress
namespace: default
4条答案
按热度按时间eyh26e7m1#
解决方案
我用这个
然后安装稳定/traefik模板与helm
values.yaml
文件是:多谢帮忙
bgibtngc2#
我自己也试过。因此,基本上当您创建Ingress时,它会使用
traefik-ui.minikube
的host
(默认值)创建,因此您将无法使用<elb-address>/dashboard/
访问 Jmeter 板。您必须使用
traefik-ui.minikube/dashboard/
访问它。例如:如果您想在浏览器上查看
/etc/hosts
文件,也可以向其中添加一个条目。您还可以在Ingress定义中使用
host
到rules
:vojdkbi03#
就因为我遇到了这个,docs说:
/dashboard/中的末尾斜杠/是必需的
rpppsulh4#
这周我遇到了这个问题。我尝试了很多方法,但最简单的一个有效。试试/#/ after /dashboard。