aws eks get-token

From wikieduonline
Jump to navigation Jump to search

aws eks get-token [1] get a token for authentication with an Amazon EKS cluster. This can be used as an alternative to the aws-iam-authenticator.

Examples

aws eks get-token --cluster-name  your-cluster-name.eu-central-1.eksctl.io
{"kind": "ExecCredential", "apiVersion": "client.authentication.k8s.io/v1beta1", "spec": {}, "status": {"expirationTimestamp": "2022-07-28T14:31:47Z", "token": "k8s-aws-v1.aHR0cHM6Ly9zdHMuZXUtY2VudHJhbC0xLmFtYXpvbmLVNpZ25lZEhlYWRlcnM9aG9zdCUzQngtazhzLWF3cy1pZCZYLUFtei1TaWduYXR1cmU9OGU3OWNmMGI4ZTMzMjQxMzk4OGRlZjViYWNhZGEyMDNkYjE5NzM0ZjBiZGYwMjEwMjRlYTRkYjMzMGExMTZiYw"}}

Terraform

 provider "kubernetes" {
  host                   = var.cluster_endpoint
  cluster_ca_certificate = base64decode(var.cluster_ca_cert)
  exec {
    api_version = "client.authentication.k8s.io/v1alpha1"
    args        = ["eks", "get-token", "--cluster-name", var.cluster_name]
    command     = "aws"
  }
}

Related

Errors

See also

Advertising: