eks-iam-auth
Version:
Authenticate with AWS EKS clusters using AWS IAM
42 lines (29 loc) • 1.03 kB
Markdown
# eks-iam-auth
Authenticate with AWS EKS clusters using AWS IAM.
When using the AWS CLI it's possible to set up `kubectl` such that it authenticates with your cluster using AWS IAM ([docs](https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html)). It is based on `aws eks get-token` ([docs](https://docs.aws.amazon.com/cli/latest/reference/eks/get-token.html)). Unfortunately no such option currently exists in aws-sdk-js.
## Installation
```
yarn add eks-iam-auth
```
or
```
npm i eks-iam-auth
```
## Usage
```typescript
import { getBearerToken } from 'getBearerToken'
import { Client1_13 as Client } from 'kubernetes-client'
const client = new Client({
config: {
url: 'https://<endpoint>.eks.amazonaws.com',
auth: {
bearer: getBearerToken('<cluster-name>'),
},
insecureSkipTlsVerify: true,
},
})
client.apis.apps.v1.deployments.get()
```
Currently only supports using AWS credentials from process.env.
## License
eks-iam-auth is licensed under the terms of the MIT license.