godaddy / kubernetes-client

Simplified Kubernetes API client for Node.js.
MIT License
961 stars 192 forks source link

add aws ec2 support #674

Closed dolpm closed 3 years ago

dolpm commented 3 years ago

This code allows the kubernetes client to work on aws linux (where child_process doesn't work).

Firstly, it checks if the cluster is running on EKS - if so, it fetches the refreshtoken directly from aws's api instead of through shell.

To make this work, you need to have an enviroment variable "AWS_CREDENTIALS" of which the value is the path to your credentials file (ie. credentials.txt or configs/credentials.txt"

In your credentials.txt should be layed out like the one below.

accessKeyId: myaccesskeyid
secretAccessKey: `mysecreteaccesskey`

After doing this, you should be all set and it should fetch refreshtokens directly from AWS (no need to change any of your production code) :)