-->

DEVOPSZONES

  • Recent blogs

    AWS: How to Manage multiple EKS clusters From Command Line

    AWS: How to Manage multiple EKS clusters From Command Line

    AWS: How to Manage multiple EKS clusters From Command Line

    Sometimes managing  multiple  Kubernetes  clusters will be a pain. This setup might help you reduce that Confusion. This will be handy to know how to conveniently use context-switch between them in the same command line. 

    1. Authenticate to AWS CLI

    First, let's authenticate to the AWS CLI:

    #aws configure

    2. List and Connect to an EKS cluster using the AWS CLI

    Great, we're authenticated with the CLI, now we need to list the clusters.

    # aws eks list-clusters


    3. Targeting your cluster with config get-contexts and use-context

    Using "kubectl config get-contexts" we'll be able to see all the clusters we've authenticated against:

    #kubectl config get-contexts

    You can see that the first one in my list is marked with the asterisk *. This is the cluster that is currently selected and that my kubectl commands targets.

    To Switch cluster:

    #kubectl config use-context <yourClusterName>

    Now you're targeting the other cluster.

    4. Add Aliases

    Adding aliases will make things easier and you can remember it easily too. 

    #alias ALIAS=kubectl config use-context <clusterName>

    This creates the alias with the name you specify for "ALIAS", which then executes the command I specified above. I then did the same for some other clusters I wanted quick access to.



    No comments