Last active
January 6, 2025 20:21
-
-
Save gbzarelli/48f7ef6c0f8a7833659ce78754c19764 to your computer and use it in GitHub Desktop.
Forward http requests between services with AWS ALB Ingress - Redirect http request method between services #helpdev-blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: ingress-my-services | |
namespace: my-services | |
annotations: | |
alb.ingress.kubernetes.io/actions.ssl-redirect: > | |
{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}} | |
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:xxxx:xxxxx | |
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]' | |
alb.ingress.kubernetes.io/scheme: internal | |
alb.ingress.kubernetes.io/target-type: ip | |
alb.ingress.kubernetes.io/load-balancer-attributes: idle_timeout.timeout_seconds=60 | |
alb.ingress.kubernetes.io/actions.forward-get: > | |
{"type": "forward", "forwardConfig": { "targetGroups": [{ "serviceName": "my-services-a", "servicePort": 80, "weight": 1 }]}} | |
alb.ingress.kubernetes.io/conditions.forward-get: > | |
[{"field":"http-request-method","httpRequestMethodConfig":{"Values":["GET"]}}] | |
alb.ingress.kubernetes.io/actions.forward-other: > | |
{"type": "forward", "forwardConfig": { "targetGroups": [{ "serviceName": "my-services-b", "servicePort": 80, "weight": 1 }]}} | |
spec: | |
ingressClassName: ingress-default-aws | |
rules: | |
- host: my-services.helpdev.com.br | |
http: | |
paths: | |
- path: / | |
pathType: Prefix | |
backend: | |
service: | |
name: ssl-redirect | |
port: | |
name: use-annotation | |
- path: / | |
pathType: Prefix | |
backend: | |
service: | |
name: forward-get | |
port: | |
name: use-annotation | |
- path: / | |
pathType: Prefix | |
backend: | |
service: | |
name: forward-other | |
port: | |
name: use-annotation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment