Skip to content

Lambda function that deregisters instances from AWS ALB and labels them in kubernetes

License

Notifications You must be signed in to change notification settings

learoyklinginsmith/kube_alb_lambda_deregister

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kube_alb_lambda_deregister

Lambda function that gracefully deregisters instances from ALB prior to shutdown.

This function is part of a workaround for kubernetes' aws-alb-ingress-controller not deregistering instances from ALB in time when CA scales down, resulting in 502's to the clients in the period between instance shutdown and ALB halthchecks failure.

This is to be used with ALB + nodeport setup.

This will do 2 things:

  1. Label nodes in Kubernetes with alpha.service-controller.kubernetes.io/exclude-balancer: true, so the aws-alb-ingress-controller will not add them back to the loadbalancer during shutdown.
  2. Deregisters the instance from ALB to trigger 'draining' state and be removed gracefuly.

This should be triggered on lifecycle-hooks configured in the Autoscaler Group in AWS.

About

Lambda function that deregisters instances from AWS ALB and labels them in kubernetes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.9%
  • Shell 5.1%