<p>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?</p>
<p>I have the kubeconfig file on my second machine already but on running kubectl, it gives me a connection error,</p>
<p>Edit: Both the vpcs are private and have the similar CIDR.</p>

Aditya
<ul>
<li>If both of your <strong>EC2</strong> are in diff VPCs you can do the <code>VPC peering</code>.</li>
<li>If you want to expose your master and K8s setup you can directly use the public IP(if exist) of EC2 and <code>kubectl</code> will connect to k8s cluster over the internet.</li>
</ul>
<p>You can also checkout peering multiple VPC with same cidr range if you are looking for that way : <a href="https://stackoverflow.com/questions/38301308/multiple-vpc-and-subnet-with-same-cidr-blocks">Multiple VPC and Subnet with same CIDR blocks</a></p>
<p>Or : <a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-partial-access.html#two-vpcs-peered-specific-cidr" rel="nofollow noreferrer">https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-partial-access.html#two-vpcs-peered-specific-cidr</a></p>
