Home > Software engineering >  Access control plane from another ec2 instance
Access control plane from another ec2 instance

Time:05-20

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.

CodePudding user response:

  • 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

Or : https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-partial-access.html#two-vpcs-peered-specific-cidr

CodePudding user response:

  • If your eks api server is private . then create the peering between the VPC's and allow the your Second EC2 server private ip
  • If your eks api server is pubclic then you can allow your Second EC2 instance public ip from aws console eks security or network section
  • Related