Reputation: 2722
I have created EKS cluster. VPC which is part of EKS has 4 subnets . 2 public subnets and 2 private subnets . Added the worker node groups as well which has 3 nodes.
Now , the issue is all these worker nodes are deployed in public subnets. However, I want atleast one node in private subnet .
Please suggest that , how to deploy worker node in private subnet through EKS management console
Upvotes: 1
Views: 709
Reputation: 1
If you want to deploy to a private subnet (private_node_group), you can use labels. follow my code below:
Terraform to create private_node_group:
resource "aws_eks_node_group" "private-nodes" {
cluster_name = "cluster_name"
node_group_name = "private-nodes"
node_role_arn = aws_iam_role.nodes.arn
subnet_ids = [private_subnet_id_1, private_subnet_id_2]
labels = {
nodegroup = "private"
}
}
.yaml file to deploy k8s. in values.yaml file:
nodeSelector: {
nodegroup: private
}
template/deployment.yaml file:
spec:
template:
spec:
[...]
nodeSelector:
nodegroup: {{ .Values.nodeSelector.nodegroup }}
Upvotes: 0
Reputation: 1
Follow this guide to create managed nodegroup https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html
Specify the private subnets while configuring the Networking as mentioned in Point no. 8.
Upvotes: 0