在EKS上部署Traefik与应用负载均衡控制器。

huangapple go评论49阅读模式
英文:

Deploying traefik on EKS with Application Load Balancer controller

问题

我正在尝试在AWS EKS集群上使用Load Balancer Controller设置traefik。以下是我的helm-values.yml文件的外观:

ingressClass:
  enabled: true
  isDefaultClass: true
ingressRoute:
  dashboard:
    enabled: false
service:
  enabled: true
  type: NodePort
globalArguments:
  - "--api.insecure=true"

我使用以下命令通过helm chart部署traefikhelm install traefik traefik/traefik --create-namespace --namespace=traefik --values=helm-values.yaml

接下来,我创建了dashboard.yml文件来部署traefik仪表板。以下是dashboard.yml文件的外观:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: traefik
  name: traefik-ingress
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: instance
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: traefik
                port:
                  number: 80
---
apiVersion: v1
kind: Secret
metadata:
  name: basic-auth-creds
  namespace: traefik
type: kubernetes.io/basic-auth
stringData:
  username: test
  password: password
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: basic-auth
  namespace: traefik
spec:
  basicAuth:
    secret: basic-auth-creds
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: dashboard
  namespace: traefik
spec:
  entryPoints:
    - web
  routes:
    - match: PathPrefix(`/dashboard`, `/dashboard/`) || PathPrefix(`/api`, `/api/`)
      kind: Rule
      services:
        - name: api@internal
          kind: TraefikService
      middlewares:
        - name: basic-auth
          namespace: traefik

当我部署dashboard.yml文件时,我可以看到一个应用程序负载均衡器被创建,但健康检查失败,当我访问http://myalbdnsname/dashboard时,我收到404页面未找到错误。我漏掉了什么?

英文:

I am trying to setup traefik on AWS EKS Cluster with Load Balancer Controller.

Here is how my helm-values.yml file looks like:

ingressClass:
  enabled: true
  isDefaultClass: true
ingressRoute:
  dashboard:
    enabled: false
service:
  enabled: true
  type: NodePort
globalArguments:
  - "--api.insecure=true"

I deploy trefik using helm chart by issuing command: helm install traefik traefik/traefik --create-namespace --namespace=traefik --values=helm-values.yaml

Next, I created dashboard.yml file to deploy the traefik dashboard. This is how the dashboard.yml file looks like:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: traefik
  name: traefik-ingress
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: instance
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: traefik
                port:
                  number: 80
---
apiVersion: v1
kind: Secret
metadata:
  name: basic-auth-creds
  namespace: traefik
type: kubernetes.io/basic-auth
stringData:
  username: test
  password: password
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: basic-auth
  namespace: traefik
spec:
  basicAuth:
    secret: basic-auth-creds
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: dashboard
  namespace: traefik
spec:
  entryPoints:
    - web
  routes:
    - match: PathPrefix(`/dashboard`, `/dashboard/`) || PathPrefix(`/api`, `/api/`)
      kind: Rule
      services:
        - name: api@internal
          kind: TraefikService
      middlewares:
        - name: basic-auth
          namespace: traefik

When I deploy dashboard.yml file, I can see a Application Load Balancer being created but the health checks fail and when I visit http://myalbdnsname/dashboard, I get 404 page not found error

What am I missing here?

答案1

得分: 1

尝试在"dashboard"后面添加斜杠,这样就会变成http://myalbdnsname/dashboard/

英文:

Try to add / after dashboard
So it'll be http://myalbdnsname/dashboard/

huangapple
  • 本文由 发表于 2023年5月18日 03:05:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76275440.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定