How to connect AWS eks from kubectl

Jan 13, 2023 min read

awskubernetes

By the way this is the new journey to handled cloud provider like AWS, with complexity because I don’t have many knowledge about that. Okay back to the topic.

Requirement you must have:

  • AWS CLI
  • kubectl
  • access key and secret key AWS

For the first make sure you can access the AWS from aws CLI, run this command

aws eks list-cluster

if you dont have any default region, you can add with --region parameter. Ex: --region us-west-1

After that you will show what the k8s cluster name, for access the cluster name who show up after your list eks. Just run this command to apply in kubeconfig

aws eks --region region_name update-kubeconfig --name cluster_name

and check with kubectl get pod for ensure that kubectl can access eks cluster.

additional:

when you save aws acces/secret key on file. you must activate with profile name, for the example

 aws eks --region region_name update-kubeconfig --name cluster_name --profile profile_name

Just like that for notes todah, hopefully I can still exist to update this website