Ever searched for
kubectl update config from aws eks and needed a quick result?
Step 1 – Validate AWS CLI
Make sure that you have valid AWS Credentials setup in your
You can check this by typing:
This will let you know where your
aws cli is pointing to.
You may need to update your
~/.aws/credentials file with a
aws_session_token if these are generated for you by your Single Sign On (SSO).
If you have a profile you want to use going forward, that isn’t the default, then you can export it into the current CLI session. This will prevent you having to type
--profile <profile_name> each time you make an API call.
Step 2 – Update Kubectl Config
Next you will need to get
aws cli to update the local
~/.kube/config file for you.
To do this, replace the following with your
aws_region it is deployed in:
If this was successful, you should get a response that looks something like:
Step 3 – Verify Cluster Information
To guarantee that you are connected to the cluster you wanted, run the following command:
This will output something like:
Some related questions
How do I update my Kubeconfig file?
How do I upgrade AWS EKS?
Option 1 – From the AWS Management Console
You can do this directly from the AWS Management Console.
- Open the Amazon EKS console at https://console.aws.amazon.com/eks/home#/clusters.
- Choose the name of the Amazon EKS cluster to update and choose Update cluster version.
- For Kubernetes version, select the version to update your cluster to and choose Update.
- For Cluster name, enter the name of your cluster and choose Confirm.The update takes several minutes to complete.
Option 2 – From the AWS CLI
Alternatively, from the AWS CLI, you can do the following:
This will provide you with a
update id, which you can use to query the cluster upgrade as it progresses:
Option 3 – Using the EKSCtl
You can also use the EKSCtl to do this for you:
What is Kubeconfig file in Kubernetes?
kubeconfig is a file used to configure access to Kubernetes when used along with the
kubectl CLI tool.
How do I get Kubeconfig file?
You can get the
kubeconfig file by running the following command:
How long does EKS upgrade take?
It can take around 20 minutes to create and prepare an EKS cluster, dependent on the amount of nodes and configuration required.
How do I change the context in kubectl?
You can use the
set-context command to quickly switch between Kubernetes/EKS clusters.
First you will need to know what config exists.
Once you know this, you can set a context:
Next we can see what the current context is:
This now allows us to
use-context to switch: