When operating Kubernetes, the kubectl version must be compatible with the Kubernetes cluster version. This is documented in both the Kubernetes official documentation under Version Skew Policy and explicitly mentioned in the Amazon EKS documentation.

 

kubectl

kubectl is supported within one minor version (older or newer) of kube-apiserver.

Example:

  • kube-apiserver is at 1.32
  • kubectl is supported at 1.33, 1.32, and 1.31

Note:

If version skew exists between kube-apiserver instances in an HA cluster, this narrows the supported kubectl versions.

Example:

  • kube-apiserver instances are at 1.32 and 1.31
  • kubectl is supported at 1.32 and 1.31 (other versions would be more than one minor version skewed from one of the kube-apiserver components)

https://kubernetes.io/releases/version-skew-policy/#kubectl

 

Version Skew Policy

The maximum version skew supported between various Kubernetes components.

kubernetes.io

 

You must use a kubectl version that is within one minor version difference of your Amazon EKS cluster control plane. For example, a 1.31 kubectl client works with Kubernetes 1.30, 1.31, and 1.32 clusters.

https://docs.aws.amazon.com/en_us/eks/latest/userguide/install-kubectl.html#kubectl-install-update

 

Set up kubectl and eksctl - Amazon EKS

You must use a kubectl version that is within one minor version difference of your Amazon EKS cluster control plane. For example, a 1.31 kubectl client works with Kubernetes 1.30, 1.31, and 1.32 clusters.

docs.aws.amazon.com

 

When using Amazon EKS clusters, you might notice version strings like v1.29.0-eks-5e0fdde when running kubectl commands (Reference: https://aws.amazon.com/blogs/tech/how-to-upgrade-amazon-eks-worker-nodes-with-karpenter-drift/). According to the Amazon EKS User Guide - kubectl and eksctl setup documentation, this binary is identical to the upstream community version. While using the same binary, version strings might be customized for various reasons, such as cloud providers building binaries directly to establish trust, or for internal version management purposes (e.g., distinguishing specific environment builds - v1.32.0-internal, test environment - v1.32.0-test, development stages - v1.29.0-dev).

 

Let's customize the version string using the Kubernetes source directly.

 

Prerequisites

Build Procedure

1. Clone source code

Clone the Kubernetes GitHub repository and navigate to the directory:

$ git clone https://github.com/kubernetes/kubernetes
$ cd kubernetes

 

2. Check existing version tags

Use the following command to view a list of Kubernetes versions from latest to oldest releases. When you see a colon (:) at the beginning, you can press spacebar to see more entries and press 'q' to exit:

$ git tag --sort=-taggerdate

 

 

3. Select and checkout version

Store the desired version tag in a local environment variable and use the "git checkout" command to switch to that version's source code. Here, we use an environment variable named TAG to store the value and use it in $TAG format to checkout the corresponding version:

$ TAG=v1.31.2 # Must use a version that exists in the git tag list

$ git checkout $TAG

 

4. Set custom tag

The Kubernetes build process is configured to primarily use existing tags stored in the Git repository. Rather than modifying this approach, let's remove the existing tags and apply a custom tag to the currently checked-out source. Note that we can't use arbitrary strings; we must follow the "v{SEMVER}-{CUSTOM}" format. SEMVER refers to the version numbering described at https://semver.org/, and the {CUSTOM} portion can be set with a simple string according to our purposes:

# Remove existing tags
git tag | xargs git tag -d

# Disable fetching remote tags
git config --local fetch.tags false

# Create new custom tag
git tag $TAG-aewstest

 

5. Verify tag

Use the following command to verify that the tag was properly applied:

$ git describe --tags --match='v*'

 

6. Build kubectl

Now let's use the make command to build. Run the following command:

$ make all WHAT=cmd/kubectl GOFLAGS=-v

 

(kubectl build - start)

 

(kubectl build - end!)

 

7. Verify build result

The built binary is created in the _output folder. Let's run the kubectl binary:

$ _output/bin/kubectl version

 

Important Notes

As mentioned above, kubectl version must be within one minor version difference of the cluster version. When using in test environments, ensure thorough validation, and for production environments, it's recommended to use the officially distributed kubectl binary.

 

 

Install Tools

Set up Kubernetes tools on your computer.

kubernetes.io

Conclusion

While this custom-built kubectl can have desired version strings and potentially be useful in CI/CD for cluster management through version checking, it's recommended to use official releases in production environments and limit custom builds to testing or development environments.

For those who have been using Windows for a long time, adding and removing programs through the Control Panel might be familiar. The "Add or Remove Programs" feature was renamed to "Programs and Features," allowing users to view, modify, and remove installed software.

0. Checking AWS CLI Version

In Windows 11, you can search for "AWS" in the "Programs and Features" menu to see the installed version of AWS CLI, which is 2.15.9.0 in this example.

(Searching with "AWS" keyword on my Windows 11 computer)

 

AWS CLI is a command-line tool that lets you manage AWS services. By running aws configure, you can easily set up your Access Key ID, Secret Access Key, and your target region name to control your AWS services. Initially, you might have downloaded and installed AWS CLI directly from the official website. However, checking for updates and upgrading to the latest version can be tedious. This is where winget comes in handy for managing AWS CLI upgrades.

1. Introduction to winget

winget is a package manager for Windows 10 and later, allowing you to install, upgrade, and remove software easily. You can automate software management using CLI commands. To install winget, search for "App Installer" in the Microsoft Store or visit this link and click the "Install" button.

Installing "App Installer" for winget using Microsoft Store

 

2. Basic winget Commands

Using winget is similar to using apt on Ubuntu. If you're familiar with the sudo apt update && sudo apt upgrade commands, you'll find winget's update and upgrade commands straightforward. Note that update is an alias for upgrade. For detailed help, visit this link or refer to the blog post (in Korean) by Microsoft MVP Soonman Kwon.

 

winget vs. apt (looks quite similar, doesn't it?)

 

3. Installing AWS CLI

While the official AWS documentation provides instructions for downloading and installing the MSI installer, you can also use winget for a hassle-free installation. Visit winget.run for the AWS CLI installation command. Note that the site may not always have the latest version information.

How to install AWS CLI from https://winget.run/pkg/Amazon/AWSCLI (Note: this this may not be the latest version on the website).

4. Upgrading and Managing AWS CLI with winget

If AWS CLI is already installed, you can upgrade to the latest version with the following command:

> winget install Amazon.AWSCLI

To check the installed version of AWS CLI, run:

> aws --version
aws-cli/2.15.9 Python/3.11.6 Windows/10 exe/AMD64 prompt/off

 

You can also check the installed version and the latest available version using PowerShell:

> winget list | Select-String -Pattern AWS

Freedom Scientific JAWS 2024            FreedomScientific.JAWS.2024              2024.2310.70.400     2024.240??winget
Freedom Scientific JAWS Training Table??{AE1E7553-752E-4D04-9695-EE1FB83C54AE}   25.0.2005.0
AWS Command Line Interface v2           Amazon.AWSCLI                            2.15.9.0             2.16.4    winget

 

To update to the latest version, execute:

> winget upgrade Amazon.AWSCLI

 

To uninstall AWS CLI, use:

 
> winget uninstall Amazon.AWSCLI

5. Upgrading Multiple Packages with winget

winget allows you to upgrade multiple packages at once. To upgrade all software, use:

winget upgrade --all​
or below to upgrade a specific package:
 
winget upgrade [package_name]
 
 

Using winget to install, upgrade, and remove AWS CLI is straightforward. Keeping your software up to date ensures you have the latest features and security patches. Regularly check for upgrades using winget to manage AWS CLI and other installed software efficiently.

+ Recent posts