amazon-web-serviceskubernetesamazon-ec2kubectl

Is there a way to point my machine's kubectl to a K8s cluster hosted on EC2 Instances?


I want to point my machine's kubectl to a cluster running on EC2 instances.

When using EKS, it's fairly easy, we just need to run:

aws eks --region=<REGION> update-kubeconfig --name <CLUSTER_NAME>

However, how can I get the same behaviour if my master-nodes and worker-nodes are hosted on EC2 instances directly?


Solution

  • Firstly download your cluster config from master node to your machine. Then you need to merge downloaded config with your existing config on your local.

    This post will help you how to merge them.

    Then you can manage your configs with kubectx.