You are currently viewing The best way to Replace Kubectl Config from AWS EKS

The best way to Replace Kubectl Config from AWS EKS

Ever looked for kubectl replace config from aws eks and wanted a fast consequence?

Step 1 – Validate AWS CLI

Just remember to have legitimate AWS Credentials setup in your aws cli.

You possibly can test this by typing:

aws sts get-caller-identity

This can let you already know the place your aws cli is pointing to.

Chances are you’ll must replace your ~/.aws/credentials file with a profile_name, aws_access_key_id, aws_secret_access_key and aws_session_token if these are generated for you by your Single Signal On (SSO).

If in case you have a profile you need to use going ahead, that isn’t the default, then you’ll be able to export it into the present CLI session. This can forestall you having to sort --profile <profile_name> every time you make an API name.

export AWS_PROFILE=<profile_name_in_credentials_file>

Step 2 – Replace Kubectl Config

Subsequent you will want to get aws cli to replace the native ~/.kube/config file for you.

To do that, exchange the next along with your cluster_name and aws_region it’s deployed in:

aws eks update-kubeconfig --name <your_eks_cluster_name> --region <aws_region>

If this was profitable, you need to get a response that appears one thing like:

Added new context arn:aws:eks:<area>:<accountnumber>:cluster/<clustername> to /Customers/consumer/.kube/config

Step 3 – Confirm Cluster Data

To ensure that you’re linked to the cluster you needed, run the next command:

kubectl cluster-info

This can output one thing like:

Kubernetes management airplane is operating at<area>
CoreDNS is operating at<area>

To additional debug and diagnose cluster issues, use 'kubectl cluster-info dump'.

How do I replace my Kubeconfig file?

aws eks update-kubeconfig --name <your_eks_cluster_name> --region <aws_region>

How do I improve AWS EKS?

Choice 1 – From the AWS Administration Console

You are able to do this immediately from the AWS Administration Console.

  1. Open the Amazon EKS console at
  2. Select the identify of the Amazon EKS cluster to replace and select Replace cluster model.
  3. For Kubernetes model, choose the model to replace your cluster to and select Replace.
  4. For Cluster identify, enter the identify of your cluster and select Affirm.The replace takes a number of minutes to finish.

Choice 2 – From the AWS CLI

Alternatively, from the AWS CLI, you are able to do the next:

aws eks update-cluster-version 
 --region <area> 
 --name <cluster-name> 
 --kubernetes-version 1.22 # specify the model you need to improve to

This can give you a replace id, which you should utilize to question the cluster improve because it progresses:

aws eks describe-update 
  --region <area> 
  --name <cluster-name> 
  --update-id abc12318-9a87-xxxx-b5a0-825e6e844789

Choice 3 – Utilizing the EKSCtl

You can even use the EKSCtl to do that for you:

eksctl improve cluster --name <cluster-name> --approve

What’s Kubeconfig file in Kubernetes?

The kubeconfig is a file used to configure entry to Kubernetes when used together with the kubectl CLI device.

How do I get Kubeconfig file?

You may get the kubeconfig file by operating the next command:

aws eks update-kubeconfig --region <area> --name <cluster-name>

How lengthy does EKS improve take?

It could possibly take round 20 minutes to create and put together an EKS cluster, depending on the quantity of nodes and configuration required.

How do I modify the context in kubectl?

You should utilize the set-context command to rapidly change between Kubernetes/EKS clusters.

First you will want to know what config exists.

kubectl config view

As soon as you already know this, you’ll be able to set a context:

kubectl config set-context 

Subsequent we will see what the present context is:

kubectl config current-context

This now permits us to use-context to modify:

kubectl config use-context <context-name>

Leave a Reply