I am creating 11 pods on EKS kubernetes. I have two public and two private subnets. In that, I have to move 10 pods in private subnet and 1 pod in public subnet. The reason behind moving in a public subnet is I have to attach public facing load balancer IP to it. But I have not sure how to move particular pod in particular subnet on EKS. I got similar question asked here. But. didn't got answer. All things I am creating via Cloudformation. How can I create particular pod in particular subnet on EKS?
1
- Dennis Griesert's answer can fix issue. When node has network internface only in private subnets or public subnets. If my nodes have both public subnet and private subnet. How can I specific pod to private subnets ?PaPu– PaPu2022-03-14 10:21:33 +00:00Commented Mar 14, 2022 at 10:21
Add a comment |
1 Answer
Seems like Kubernetes' nodeSelector is the thing you need. You just have to add a fitting label to the nodes, this answer will help you automate it.
2 Comments
ImPurshu
Thanks Dennis. But how can attach a label to individual worker nodes. The link you provided attaching same label to all worker nodes. But I want attach label like if nodes in public subnet, I want to attach public label, if in private subnet , attach private as label.
Dennis Griesert
You can get instance metadata as described here. Just add what reference you deem necessary (e.g. the subnet) to the user-data running on the instances.