简体   繁体   English

K8S:运行负载均衡器同步例程时出错

[英]K8S: Error running load balancer syncing routine

Trying to get ThingsBoard running on google cloud.试图让ThingsBoard在谷歌云上运行。

I am now seeing the following error:我现在看到以下错误:

Error during sync: error running load balancer syncing routine: loadbalancer thingsboard-tb-ingress--013d7ab9087175d7 does not exist: CreateUrlMap: googleapi: Error 400: Invalid value for field 'resource': '{ "name": "k8s-um-thingsboard-tb-ingress--013d7ab9087175d7", "hostRule": [{ "host": ["*"], "...'. Invalid path pattern, invalid同步期间出错:运行负载均衡器同步例程时出错:负载均衡器 thingsboard-tb-ingress--013d7ab9087175d7 不存在:CreateUrlMap:googleapi:错误 400:字段“资源”的值无效:'{“名称”:“k8s-um- thingsboard-tb-ingress--013d7ab9087175d7", "hostRule": [{ "host": ["*"], "...'。路径模式无效,无效

kubectl describe ingress gives me the following: kubectl describe ingress 给我以下信息:

Name:             tb-ingress
Namespace:        thingsboard
Address:
Default backend:  default-http-backend:80 (10.52.0.5:8080)
Rules:
  Host  Path  Backends
  ----  ----  --------
  *
        /api/v1/.*            tb-http-transport:http (<none>)
        /static/rulenode/.*   tb-node:http (<none>)
        /static/.*            tb-web-ui:http (<none>)
        /index.html.*         tb-web-ui:http (<none>)
        /                     tb-web-ui:http (<none>)
        /.*                   tb-node:http (<none>)
Annotations:
  kubectl.kubernetes.io/last-applied-configuration:  {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"nginx.ingress.kubernetes.io/proxy-read-timeout":"3600","nginx.ingress.kubernetes.io/ssl-redirect":"false","nginx.ingress.kubernetes.io/use-regex":"true"},"name":"tb-ingress","namespace":"thingsboard"},"spec":{"rules":[{"http":{"paths":[{"backend":{"serviceName":"tb-http-transport","servicePort":"http"},"path":"/api/v1/.*"},{"backend":{"serviceName":"tb-node","servicePort":"http"},"path":"/static/rulenode/.*"},{"backend":{"serviceName":"tb-web-ui","servicePort":"http"},"path":"/static/.*"},{"backend":{"serviceName":"tb-web-ui","servicePort":"http"},"path":"/index.html.*"},{"backend":{"serviceName":"tb-web-ui","servicePort":"http"},"path":"/"},{"backend":{"serviceName":"tb-node","servicePort":"http"},"path":"/.*"}]}}]}}

  nginx.ingress.kubernetes.io/proxy-read-timeout:  3600
  nginx.ingress.kubernetes.io/ssl-redirect:        false
  nginx.ingress.kubernetes.io/use-regex:           true
Events:
  Type     Reason  Age               From                     Message
  ----     ------  ----              ----                     -------
  Warning  Sync    3m (x28 over 1h)  loadbalancer-controller  Error during sync: error running load balancer syncing routine: loadbalancer thingsboard-tb-ingress--013d7ab9087175d7 does not exist: CreateUrlMap: googleapi: Error 400: Invalid value for field 'resource': '{  "name": "k8s-um-thingsboard-tb-ingress--013d7ab9087175d7",  "hostRule": [{    "host": ["*"],    "...'. Invalid path pattern, invalid

What am I missing here?我在这里错过了什么?

I forgot to specify kubernetes.io/ingress.class: "nginx" annotation.我忘记指定 kubernetes.io/ingress.class: "nginx" 注释。 If you don't specify any kubernetes.io/ingress.class - GKE will consider using its own ingress which does not support regexps and gives the error mentioned.如果您没有指定任何 kubernetes.io/ingress.class - GKE 将考虑使用它自己的入口,它不支持正则表达式并给出提到的错误。

The error occurs when using the default gke loadbalancer and using the wrong path expression.使用默认的 gke 负载均衡器并使用错误的路径表达式时会出现错误。 From the documentation: https://cloud.google.com/kubernetes-engine/docs/how-to/load-balance-ingress来自文档: https ://cloud.google.com/kubernetes-engine/docs/how-to/load-balance-ingress

  • The only supported wildcard character for the path field of an Ingress is the * character. Ingress 的路径字段唯一支持的通配符是 * 字符。 The * character must follow a forward slash (/) and must be the last character in the pattern. * 字符必须跟在正斜杠 (/) 之后,并且必须是模式中的最后一个字符。 For example, / , /foo/ , and /foo/bar/* are valid patterns, but , /foo/bar , and /foo/*/bar are not.例如, / 、 /foo/和 /foo/bar/* 是有效模式,但是、 /foo/bar和 /foo/*/bar 不是。
  • A more specific pattern takes precedence over a less specific pattern.更具体的模式优先于不太具体的模式。 If you have both /foo/* and /foo/bar/ , then /foo/bar/bat is taken to match /foo/bar/ .如果您同时拥有 /foo/* 和 /foo/bar/ ,那么 /foo/bar/bat 将被用来匹配 /foo/bar/ For more information about path limitations and pattern matching, see the URL Maps documentation.有关路径限制和模式匹配的更多信息,请参阅 URL 映射文档。

You don't need to set a host entry per se, this error is actually very confusing and unclear.您本身不需要设置主机条目,这个错误实际上非常混乱和不清楚。

From the same page, this is a valid configuration:在同一页面上,这是一个有效的配置:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    # If the class annotation is not specified it defaults to "gce".
    kubernetes.io/ingress.class: "gce"
spec:
  rules:
  - http:
      paths:
      - path: /*
        backend:
          serviceName: hello-world
          servicePort: 60000
      - path: /kube
        backend:
          serviceName: hello-kubernetes
          servicePort: 80

To use regular expression you need to use another ingress controller, like nginx or haproxy:要使用正则表达式,您需要使用另一个入口控制器,例如 nginx 或 haproxy:

https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke

https://github.com/haproxytech/kubernetes-ingress#readme https://github.com/haproxytech/kubernetes-ingress#readme

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 EKS:同步负载均衡器时出错:无法确保负载均衡器:例如找到多个标记的安全组 - EKS: Error syncing load balancer: failed to ensure load balancer: Multiple tagged security groups found for instance K8s Pod 失败:运行 Pod“app”的“VolumeBinding”预绑定插件时出错:绑定卷失败:等待条件超时 - K8s Pods Failure : error while running "VolumeBinding" prebind plugin for pod "app": Failed to bind volumes: timed out waiting for the condition K8s Daemonset Pod 放置 - K8s Daemonset Pod Placement Azure 上 k8s principals 的区别 - Difference between k8s principals on Azure GCP 上的 K8s 上的 label 值无效 - Invalid label value on K8s on GCP K8s deamon 设置高可用性 - K8s deamon set high avialibality k8s:将 YAML 转换为 JSON 时出错:yaml:第 33 行:找到无法启动任何标记的字符 - k8s: error converting YAML to JSON: yaml: line 33: found character that cannot start any token AWS 负载均衡器 Controller:无法识别“”:版本 .networking.k8s.io/v1 中种类“IngressClass”没有匹配项” - AWS Load Balancer Controller: unable to recognize "": no matches for kind "IngressClass" in version "networking.k8s.io/v1" k8s 使用 ownerRef 获取集群中的所有 pod 层次结构 - k8s get all pods hierarchy in cluster with ownerRef's K8s postgres 备份在 S3 复制期间失败 - K8s postgres backup failed during S3 copy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM