kube-eks-config
Helpers for building a [kube::Client] directly from an Amazon EKS
cluster name, without managing a kubeconfig file on disk.
How it works
The crate calls the AWS EKS DescribeCluster API to retrieve the cluster's
HTTPS endpoint and certificate-authority data, then converts those values into
the configuration structs used by [kube]. Authentication (bearer
tokens) is intentionally omitted: EKS uses short-lived tokens obtained via
aws eks get-token, IRSA, or EKS Pod Identity — none of which belong in a
static config.
aws_sdk_eks::Client ──► EKS cluster name ──► kube::Config ──► kube::Client
Usage
Add to your Cargo.toml:
[]
= "3.0"
= { = "3.0", = ["client", "rustls-tls"] }
= { = "1", = ["full"] }
One-shot: get a ready-to-use client
use ;
async
Step by step
The three methods on TryEksClusterExt form a convenience ladder — use the
one that returns exactly what you need:
use ;
async
Producing a Kubeconfig struct
Use IntoKubeconfig when you need the serialisable kubeconfig format (e.g. to
write it to disk or merge it with an existing ~/.kube/config):
use ;
async
AWS credentials
default_aws_client() resolves credentials via the standard AWS provider chain
(highest priority first):
- Environment variables —
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN,AWS_REGION/AWS_DEFAULT_REGION - AWS shared files —
~/.aws/credentialsand~/.aws/config - Web identity / IRSA —
AWS_WEB_IDENTITY_TOKEN_FILE+AWS_ROLE_ARN(Kubernetes pods with IAM Roles for Service Accounts) - Instance metadata — EC2 instance profile or ECS task role via IMDSv2
For fine-grained control over credentials, region, or endpoint configuration,
construct an aws_sdk_eks::Client directly and use TryEksClusterExt on it.
Traits at a glance
| Trait | Input | Output |
|---|---|---|
TryEksClusterExt |
eks::Client + cluster name |
raw cluster / Config / Client |
ToKubeConfig |
eks::types::Cluster |
kube::Config |
IntoKubeconfig |
eks::types::Cluster |
kube::config::Kubeconfig |
Examples
| Example | Description |
|---|---|
getpods-eks |
List pods using an EKS cluster name (uses this crate) |
getpods |
List pods using the kubeconfig already on disk (baseline) |
Run with:
Versioning
The version of kube-eks-config tracks the major version of
kube. A kube-eks-config 3.x.y release is
compatible with any kube 3.* release, following standard semver rules.
When kube publishes a new major version, kube-eks-config will bump its
major version to match.
License
Apache-2.0 — see LICENSE or https://www.apache.org/licenses/LICENSE-2.0.