NoMatchingWorkloadsFound

消息名称NoMatchingWorkloadsFound
消息代码IST0127
描述There aren’t workloads matching the resource labels
等级Warning

AuthorizationPolicy 资源的选择器匹配不到任何 Pod 时,会出现此消息。

示例

当集群包含以下资源时:

  1. apiVersion: security.istio.io/v1beta1
  2. kind: AuthorizationPolicy
  3. metadata:
  4. name: httpbin-nopods
  5. namespace: httpbin
  6. spec:
  7. selector:
  8. matchLabels:
  9. app: bogus-label # Bogus label. No matching workloads
  10. version: v1
  11. rules:
  12. - from:
  13. - source:
  14. principals: ["cluster.local/ns/default/sa/sleep"]
  15. - source:
  16. namespaces: ["httpbin"]
  17. to:
  18. - operation:
  19. methods: ["GET"]
  20. paths: ["/info*"]
  21. - operation:
  22. methods: ["POST"]
  23. paths: ["/data"]
  24. when:
  25. - key: request.auth.claims[iss]
  26. values: ["https://accounts.google.com"]

您会收到此消息:

  1. Warning [IST0127] (AuthorizationPolicy httpbin-nopods.httpbin) No matching workloads for this resource with the following labels: app=bogus-label,version=v1

在这个样例中, AuthorizationPolicy 资源 httpbin-nopods 需要绑定到包含 app=bogus-label 标签的 Pod 上,但是其不存在。

如何修复

  • 修改选择器 selector 以选择存在的 Pod
  • 修改特定 Pod 的标签以匹配此资源的选择器