Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAQ ALB ip vs instance mode rationale incorrect? #2171

Closed
anguslees opened this issue Jul 22, 2022 · 6 comments · Fixed by #2245
Closed

FAQ ALB ip vs instance mode rationale incorrect? #2171

anguslees opened this issue Jul 22, 2022 · 6 comments · Fixed by #2245
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@anguslees
Copy link

How do I use Karpenter with the AWS load balancer controller?

Set the ALB target type to IP mode for the pods. Use IP targeting if you want the pods to receive equal weight. Instance balancing could greatly skew the traffic being sent to a node without also managing host spread of the workload.

This sounds incorrect? I think instance-mode will send traffic equally to all nodes (to a NodePort), and thence equally to all pods (that are ready and match the service selector).

Maybe this section is confusing instance-mode with internalTrafficPolicy=Local ?

@anguslees anguslees changed the title FAQs FAQ ALB ip vs instance mode rationale incorrect? Jul 22, 2022
@bwagner5 bwagner5 added the documentation Improvements or additions to documentation label Jul 22, 2022
@ellistarn
Copy link
Contributor

Hey Gus! Feel free to cut a PR. I can check in with @chrisnegus on where this information came from.

@jicowan
Copy link

jicowan commented Jul 22, 2022

@anguslees it probably depends on how pods are distributed across the nodes in the cluster. If you don't have a pod anti-affinity policy or are not using topology spread constraints, multiple pods in a Deployment can wind up running on a small number of instances. IP targets are generally recommended because it avoids routing traffic through kube-proxy (> overhead). Unless you're using IPVS, kube-proxy will always default to RR for routing traffic so, assuming an even distribution of pods and a traffic policy of cluster, each pod should have equal weight when the target type is instance.

@ellistarn
Copy link
Contributor

ellistarn commented Jul 22, 2022

routing traffic through kube-proxy (> overhead)

Curious if we have benchmarks on this. IPTables should be pretty fast at most scales.

@jicowan
Copy link

jicowan commented Jul 22, 2022

Using IP targets can preserve the source IP in the HTTP header, making it easier to trace back to the source of the traffic. While I think the recommendation is sound (use IP targets) the rationale might need to be updated.

@anguslees
Copy link
Author

anguslees commented Jul 22, 2022

it probably depends on how pods are distributed across the nodes in the cluster.

And just to be clear, I'm saying instance mode (without internalTrafficPolicy=Local) will send an equal number of queries to pods even when those pods are packed unevenly onto nodes.

(Because the pod-level assignment is actually done by kube-proxy and iptables RR as you described)

@chrisnegus
Copy link
Member

We decided that this type of content is best suited for the AWS load balancer documentation. So I removed the content from the Karpenter FAQ (see PR #2245). I then opened an issue for the ALB docs (see Issue 2747).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants