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?
Asked
Active
Viewed 1,522 times
3
-
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 Mar 14 '22 at 10:21
1 Answers
1
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.

Dennis Griesert
- 161
- 1
- 2
- 7
-
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. – ImPurshu Mar 19 '19 at 07:35
-
You can get instance metadata as described [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html). Just add what reference you deem necessary (e.g. the subnet) to the user-data running on the instances. – Dennis Griesert Mar 19 '19 at 19:52