alb.ingress.kubernetes.io/actions annotation not working

71 Views Asked by At

I am trying to send traffic to two different pods from the same ingress using alb.ingress.kubernetes.io/actions and alb.ingress.kubernetes.io/conditions based on the "httpRequestMethodConfig".

Ref: https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/guide/ingress/annotations/#actions

https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/guide/ingress/annotations/#conditions

The tentative ingress.yaml looks li:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test-{{- .Chart.Name }}
  labels:
    app.kubernetes.io/name: {{ .Chart.Name }}
  annotations:
    alb.ingress.kubernetes.io/actions.api-rule-get:  >
      {"type":"forward", "forwardConfig":{"targetGroups":[{"serviceName":"testService1", "servicePort": 8080}]}}
    alb.ingress.kubernetes.io/conditions.api-rule-get: >
      [{"field":"http-request-method","httpRequestMethodConfig":{"Values":["GET", "HEAD"]}}]
    alb.ingress.kubernetes.io/actions.api-rule-post: >
      {"type":"forward", "forwardConfig":{"targetGroups":[{"serviceName":"testService", "servicePort": 8080}]}}
    alb.ingress.kubernetes.io/conditions.api-rule-post:  >
      [{"field":"http-request-method","httpRequestMethodConfig":{"Values":["POST"]}}]

spec:
  ingressClassName: testIngress
  rules:
    - host: www.test.com
      http:
        paths:
          - path: /v1/*
            pathType: ImplementationSpecific
            backend:
              service:
                name: api-rule-get
                port:
                  name: use-annotation
          - path: /v1/*
            pathType: ImplementationSpecific
            backend:
              service:
                name: api-rule-post
                port:
                  name: use-annotation

However, after deploying the ingress file, I get the below error:

/v1/*   api-rule-get:use-annotation (<error: endpoints "api-rule-get" not found>)
/v1/*   api-rule-post:use-annotation (<error: endpoints "api-rule-post" not found>)

What could be missing ? Any help would be appreciated.

0

There are 0 best solutions below