helm repo add eks <https://aws.github.io/eks-charts>
helm repo update eks
helm install aws-load-balancer-controller eks/aws-load-balancer-controller \\
-n kube-system \\
--set clusterName=wsc-prod-cluster \\
--set serviceAccount.create=false \\
--set serviceAccount.name=aws-load-balancer-controller
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wsc-ingress
namespace: wsc-prod
annotations:
alb.ingress.kubernetes.io/load-balancer-name: wsc-prod-lb
# alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/scheme: internal
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]'
alb.ingress.kubernetes.io/healthcheck-path: /healthcheck
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '5'
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '3'
alb.ingress.kubernetes.io/healthy-threshold-count: '3'
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
alb.ingress.kubernetes.io/target-group-attributes: deregistration_delay.timeout_seconds=30
alb.ingress.kubernetes.io/actions.targets: >
{"type":"forward","forwardConfig":{"targetGroups":[{"serviceName":"customer-service","servicePort":8080,"weight":34},{"serviceName":"order-service","servicePort":8080,"weight":33},{"serviceName":"product-service","servicePort":8080,"weight":33}]}}
spec:
ingressClassName: alb
rules:
- http:
paths:
- path: /v1/customer
pathType: Prefix
backend:
service:
name: customer-service
port:
number: 8080
- path: /v1/product
pathType: Prefix
backend:
service:
name: product-service
port:
number: 8080
- path: /v1/order
pathType: Prefix
backend:
service:
name: order-service
port:
number: 8080
- path: /healthcheck
pathType: ImplementationSpecific
backend:
service:
name: targets
port:
name: use-annotation
#!/bin/bash
private_a=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=wsc-prod-peering-sn-a" --query "Subnets[].SubnetId[]" --output text)
private_c=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=wsc-prod-peering-sn-c" --query "Subnets[].SubnetId[]" --output text)
private_subnet_name=("$private_a" "$private_c")
for name in "${private_subnet_name[@]}"
do
aws ec2 create-tags --resources $name --tags Key=kubernetes.io/role/internal-elb,Value=1
done
kubectl apply -f ingress.yaml