How do I allow a kubernetes cluster to access my ec2 machine?

6/24/2019

I want to allow a kubernetes cluster, all the pods running in it, to access my ec2 machine.

This means I have to allow a particular IP or a range of IPs in the security group of my ec2 machine.

But what is that one IP or a range of IPs that I'd have to enter in the security group of EC2 machine?

-- Aviral Srivastava
amazon-ec2
kubernetes
network-security-groups

1 Answer

6/24/2019

The pods in kubernetes run in worker nodes which are nothing but ec2 instances and have their own security group. If you want your ec2 instance which is outside the cluster to accept connection from pods in kubernetes cluster, you can add an inbound rule in the ec2 instance with source security group value that of the worker nodes security group.

Why is that the pods in the kubernetes cluster wants to access an ec2 instance outside the cluster. You can also bring the ec2 instance within your kubernetes cluster and if need be, you can expose the ec2 instance's process via kubernetes service.

-- Malathi
Source: StackOverflow