Containers
Amazon EKS add-ons: Advanced configuration
This post is a follow-up to our previous post, Amazon EKS add-ons preserve customer edits.
Introduction
In October 2022, the Amazon Elastic Kubernetes Service (Amazon EKS) add-ons team introduced the ability to preserve edits, enabling customers to safely modify the configuration of Amazon EKS add-ons by using the Kubernetes application programming interface (API). This enhancement enabled users to preserve add-on configuration changes on their clusters during update operations by passing in the --resolve-conflicts PRESERVE parameter
.
Today, we’re expanding on this work to give customers more control over their operational software, with the launch of advanced configuration support for Amazon EKS add-ons. Customers can now supply their configuration directly through the Amazon EKS add-ons API, to install and configure their operational software during cluster creation in a single step. This enables customers to leverage their existing Infrastructure as Code (IaC) tools to configure Amazon EKS vended operational software and meet performance, compliance, or additional requirements not handled by default configuration settings. Support for advanced configuration through the Amazon EKS add-ons API is available today for the following add-ons:
Configuration parameters available for these add-ons address some of the most highly requested issues on the containers roadmap, including: modifying the CoreDNS corefile, simplifying the configuration for running CoreDNS on AWS Fargate, enabling IPVS mode with kube-proxy, increasing kube-proxy memory, and enabling VPC CNI parameters such as prefix delegation.
Configuration support also unlocks an exciting new use case of simplifying the level of input required to get started with certain operational software on Amazon EKS. A good example is the AWS Distro for OpenTelemetry (ADOT), the AWS vended and support distribution of OpenTelemetry that provides open-source APIs, libraries, and agents to collect distributed traces and metrics for application monitoring. Using Amazon EKS add-ons, you install the OpenTelemetry Operator, and then configure an OpenTelemetry Collector instance through the OpenTelemetryCollector
CustomResourceDefinition (CRD). This CRD supports the full surface area of the OpenTelemetry Collector, but this can be an overwhelming amount of information for users getting started with observability on their clusters. With Amazon EKS add-ons configuration support for ADOT, you can now optionally specify cloudwatch: true
, or amp:true
in your configuration input, and Amazon EKS automatically applies a best practice custom resource to configure an OpenTelemetry Collector to send observability data to your desired destination, such as Amazon CloudWatch or Amazon Managed Service for Prometheus.
Feature overview
A new configurationValues
parameter has been added to the Amazon EKS add-ons API which accepts configuration as a JSON or a YAML blob. The configuration blob needs to conform to the underlying add-on configuration JSON schema, which is now available through the new Amazon EKS DescribeAddonConfiguration API. As seen below, the configurationValues parameter can be used with the aws eks create-addon
and aws eks update-addon
AWS Command Line Interface (AWS CLI) command.
Example create add-on workflow
To illustrate how customers can use the new configurationValues
JSON parameter, let’s consider the following scenario. Given an existing Amazon EKS cluster, we want to use the AWS CLI to add the VPC CNI add-on to the existing cluster with the create-addon command. However, we want to modify the default settings and increase the number of available IP addresses on our Amazon EC2 nodes by enabling Prefix Delegation. To customize the add-on during creation, we must first discover if the desired configuration item is available for the version of the add-on we plan to use. We’ll use the new Amazon EKS DescribeAddonConfiguration
API, with the corresponding describe-addon-configuration
CLI command to perform this discovery.
In this scenario, discovery is a two-step process. First, we use the describe-addon-versions CLI command, seen in the following example, to retrieve the versions from the Amazon EKS API.
As seen in the preceding output, versions of the add-on (i.e., VPC CNI in this case) are listed with corresponding architecture and cluster version compatibilities. With this information, we select the most appropriate version for our use case. Once the add-on version is selected, then we can use the new describe-addon-configuration CLI command to review the configuration items that can be configured.
In the preceding output, the configurationSchema
element contains the configurable elements for the selected version of the VPC CNI add-on.
Note: The returned
configurationSchema
is a standard JSON Schema, and each add-on and add-on version combination has its ownconfigurationSchema
. JSON schemas add metadata, such as descriptions, to individual fields, allowing for the schemas to serve as documentation for configuration options. Because JSON schema is an existing and established standard, it also has various third-party tools customers can use to view these schemas in a more user or developer friendly manner. Once such tool is the JSON Schema Viewer from Atlassian.
The configurable items in the configurationSchema
field include environment variables and Kubernetes configurations, and are based on underlying Helm charts that are used by Amazon EKS to install, update, and uninstall add-on software to clusters. After reviewing the output, we see that among the schema elements is the ENABLE_PREFIX_DELEGATION
environment variable, as seen in the following output.
The ENABLE_PREFIX_DELEGATION
environment variable takes a string value formatted as a boolean (true/false). This variable defaults to false, as seen in the following example.
To more easily view the output of the describe-addon-configuration
command, the output of the CLI command can be set to text, as seen in the following CLI command. This outputs unescaped JSON that’s easier to read and copy. The added query parameter does client-side filtering, and in this case, restricts the output to only return the configurationSchema
field.
With this information, and the new configurationValues
parameter, we can now craft the following create-addon CLI command, containing advanced configurations as custom YAML or JSON.
Note: The CLI command
configuration-values
parameter corresponds to the Amazon EKS add-on API configurationValues parameter.
The preceding output indicates that the add-on is in the CREATING status. We can use the describe-addon
CLI command to check the status and confirm that the added advanced configuration is now part of the ACTIVE add-on.
With the following kubectl command we can also verify that the aws-node
Daemonset in the target cluster received the specified advanced configuration.
YAML or JSON input file
The CLI command configuration-values
parameter accepts a file path instead of literal YAML or JSON text, as seen in the following example.
Using an input file, as an argument to the configuration-values
parameter, removes the need to escape and format the YAML or JSON into a flattened string for the CLI input. Using input files also allows for separation of input values from commands, which enables a better DevOps experience.
Example update add-on workflow
With the new Amazon EKS add-on API enhancements, customers can also update already created (i.e., ACTIVE) cluster add-ons and supply respective advanced configuration settings. Given a scenario where we have installed the CoreDNS add-on into our existing cluster, we now want to modify the corefile
to change the cache interval to 29, and add an additional server entry.
With the following kubectl command, we can see the current corefile that CoreDNS is using.
To update the add-on and change the CoreDNS corefile we’ll use the following update-addon
command to pass the corefile contents via a YAML or JSON input file to the CLI command configuration-values
parameter.
The preceding command updated the CoreDNS corefile, changing the cache interval to 29 and adding a server entry to handle the example.org query with the whoami plugin.
Next, we'll update the number of replicas for the coredns Deployment resource using the following CLI command.
The preceding example illustrates an important aspect of updating add-ons with advanced configurations supplied in the configurationValues
parameter. When the configurationValues
parameter is used, advanced configurations don’t persist between add-on API calls. They are overwritten by default settings unless they are explicitly included, which is by design. If you use the configurationValues
parameter and you don’t want your settings to be overwritten, then you must include them in the configurationValues
parameter of each UpdateAddon
operation.
In our CoreDNS UpdateAddon
operation, the corefile contents were reset to default settings because we didn’t add them to the update command. To include the corefile settings with the replica settings, we would add them together in the same YAML or JSON file, as seen in the following example.
It’s also important to understand when and how to use the --resolve-conflicts
parameter. Only use the --resolve-conflicts OVERWRITE
option when you are sure you won’t mistakenly overwrite settings in the add-on configuration. Settings that would be overwritten are those settings that were added to the add-on component configuration outside of the Amazon EKS add-on API, made via the Kubernetes API. If you know the settings that would need to be included as advanced configurations, and the settings are possible via the discovered configurationSchema
, then add them to the configurationValues
parameter of CreateAddon
or UpdateAddon API
operations.
Note: In our previous post, Amazon EKS add-ons preserve customer edits, we introduced the
--resolve-conflicts PRESERVE
option for the Amazon EKS APIUpdateAddon
operation. This option preserves edits made to add-on resources so that they aren’t overwritten during anUpdateAddon
operation. ThePRESERVE
option can be used with the advanced configurations made through the Amazon EKS add-on API. However, we strongly recommend that edits to add-on configurations be made via the Amazon EKS add-on API.
Updating add-ons and compatibility
Amazon EKS add-ons can be updated to newer (or older) versions. If no new advanced configuration settings are supplied, the add-on API attempts to apply any existing configuration settings. If the existing configuration settings are compatible with the changed add-on version, then the update will work, preserving these existing settings.
If current add-on settings are incompatible with the target add-on version, then an error is returned by the API. For example, given an existing Amazon EKS cluster and an existing add-on with the configuration setting, {"replicas":4}
, in the Kubernetes Deployment resource specification, the add-on API checks if the existing settings are compatible with the target add-on version. If the target version of the add-on now uses Kubernetes Daemonset resources instead of Deployments, the replicas setting will no longer be compatible. An attempt to update the add-on with the following command fails and returns an error from the add-on API.
Resetting default add-on settings via updates
For the use case where Amazon EKS add-on advanced configurations are to be removed, and default settings are desired, the add-on API UpdateAddon
call is used with an empty YAML string or JSON object (empty curly braces). For example, the following AWS CLI command can be used to update an existing add-on and remove any advanced configurations. This performs an update on the add-on, resetting all advanced configurations back to their default values.
Conclusion
In this post, we provided an overview of newly released Amazon EKS add-ons advanced configurations support. The existing DescribeAddonVersions
API call is used with the new DescribeAddonConfiguration
API call to discover available advanced configurations, by examining the configurationSchema
for the combination of add-on and add-on version. This JSON schema exposes configurable settings that allow customers to customize certain add-on settings. The configuration-values
parameter is used to supply advanced configuration settings via YAML or JSON that follows the schema found in the configurationSchema
element. If the configuration-values
parameter is provided in CreateAddon
and UpdateAddon
calls, it overrides advanced configurations settings. If no configuration-values
parameter is supplied, then the CreateAddon
and UpdateAddon
calls will not change those settings. The OVERWRITE
option can be used to resolve potential conflicts by overwriting values in the CreateAddon
or UpdateAddon
operations. The PRESERVE
option can be used to preserve edits from one operation to the next.
Calls to action
Give Amazon EKS add-ons a spin!
If you are running Amazon EKS and you haven’t tried add-ons yet, now is the time. The new advanced configurations add more robust configuration management to Amazon EKS add-ons. You can now discover additional settings that are underpinned by the Helm charts we use to manage add-ons in your clusters. This provides for more granular configurations, a more flexible user experience, and better fits new and existing DevOps automation.
Check out our containers roadmap!
If you have ideas about how we can improve Amazon EKS add-ons or other aspects of our container services, then please use our containers roadmap to provide us feedback and review our existing roadmap items.