Skip to content

Unable to generate valid sts PresignedUrl for use with EKS token auth #1922

@nickzelei

Description

@nickzelei

Describe the bug

The URL that I generate with the sts PresignClient doesn't work when used as an EKS authentication token.
I am able to generate a url with the v1 client and it works just fine.

Expected Behavior

I expect the token that I generate with the v2 client to allow me to authenticate to my EKS cluster.

Current Behavior

The token I generate, when used, results in the error:

$ kubectl get nodes
error: You must be logged in to the server (Unauthorized)

Reproduction Steps

Link to code: https://gist.github.com/nickzelei/44f371254eae0e9d00a86fe3f4f0fc48 - Update line 25 with a valid cluster name

Take the token that is printed first and drop that in a kube config.
Should get unauthorized error.

Take the second token, and do the same thing.

Possible Solution

No response

Additional Information/Context

Code I'm using to generate the token that I use to drop into a kube config.

https://gist.github.com/nickzelei/44f371254eae0e9d00a86fe3f4f0fc48

AWS Go SDK V2 Module Versions Used

	github.com/aws/aws-sdk-go-v2 v1.17.1
	github.com/aws/aws-sdk-go-v2/config v1.17.10
	github.com/aws/aws-sdk-go-v2/credentials v1.12.23
	github.com/aws/aws-sdk-go-v2/service/acm v1.15.2
	github.com/aws/aws-sdk-go-v2/service/ec2 v1.63.1
	github.com/aws/aws-sdk-go-v2/service/ecr v1.17.18
	github.com/aws/aws-sdk-go-v2/service/eks v1.22.1
	github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.18.22
	github.com/aws/aws-sdk-go-v2/service/iam v1.18.23
	github.com/aws/aws-sdk-go-v2/service/kms v1.18.11
	github.com/aws/aws-sdk-go-v2/service/s3 v1.27.9
	github.com/aws/aws-sdk-go-v2/service/sts v1.17.1
	github.com/aws/smithy-go v1.13.4

Compiler and Version used

go version go1.19.3 darwin/arm64

Operating System and version

macOS Monterey Version 12.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions