Issue
I am trying to access the kubectl of the master node that is running on an ec2 instance. I want to do this from another ec2 instance running on a different vpc. What steps should I take to make this possible?
I have the kubeconfig file on my second machine already but on running kubectl, it gives me a connection error,
Edit: Both the vpcs are private and have the similar CIDR.
Solution
- If both of your EC2 are in diff VPCs you can do the
VPC peering
. - If you want to expose your master and K8s setup you can directly use the public IP(if exist) of EC2 and
kubectl
will connect to k8s cluster over the internet.
You can also checkout peering multiple VPC with same cidr range if you are looking for that way : Multiple VPC and Subnet with same CIDR blocks
Answered By - Harsh Manvar Answer Checked By - Terry (WPSolving Volunteer)