Expand description
§kube-eks-config
Helpers for building a kube_client::Client (or kube_client::Config)
directly from an Amazon EKS cluster, without
manually 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_client. 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.
§Quick start
use kube_eks_config::{TryEksClusterExt, default_aws_client};
#[tokio::main]
async fn main() -> kube_client::Result<()> {
// Credentials are loaded from the environment (see [`default_aws_client`])
let aws = default_aws_client().await;
// One call produces a ready-to-use Kubernetes client
let client = aws.try_eks_kube_client("my-cluster").await?;
let _ = client;
Ok(())
}§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 shared credentials / config files (
~/.aws/credentials) - Web identity / IRSA (
AWS_WEB_IDENTITY_TOKEN_FILE+AWS_ROLE_ARN) - Amazon EC2 / ECS instance metadata (IMDSv2)
Any custom aws_sdk_eks::Client can also be used directly with the
TryEksClusterExt methods.
§Traits at a glance
| Trait | Input | Output |
|---|---|---|
TryEksClusterExt | eks::Client + cluster name | cluster / config / client |
ToKubeConfig | eks::types::Cluster | kube_client::Config |
IntoKubeconfig | eks::types::Cluster | kube_client::config::Kubeconfig |
Traits§
- Into
Kubeconfig - Converts an
eks::types::Clusterinto akube_client::config::Kubeconfig. - ToKube
Config - Converts an
eks::types::Clusterinto akube_client::Config. - TryEks
Cluster Ext - Extension trait that adds EKS-aware helpers to
aws_sdk_eks::Client.
Functions§
- default_
aws_ client - Creates an
aws_sdk_eks::Clientfrom the default AWS credential chain.