How do I provide AWS credentials to Kubernetes?

10/11/2015

I'm setting up a Kubernetes cluster on AWS and as part of the configuration for say the API Server, I provide the --cloud-provider=aws setting.

Once it starts up, however, I see in the logs that it complains about not having AWS credentials: NoCredentialProviders: no valid providers in chain

After some searching, it seems that this issue was resolved for most people by using the "kube-up" script. However, for those who are not using the script to set up their cluster, how do we provide Kubernetes with AWS credentials?

-- Luis Medina
amazon-web-services
kubernetes

2 Answers

6/27/2016

First get aws command line tool installed http://docs.aws.amazon.com/cli/latest/userguide/installing.html

... then create your security id key pair http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html

... then issue

aws configure

which will prompt you to enter your new key ID/secret pair + region (format defaults to json so just hit enter )

AWS Access Key ID [****************IOUQ]: 
AWS Secret Access Key [****************bsXr]: 
Default region name [us-east-1]: 
Default output format [None]: 

... then put this into your cluster spin-up script to provide AWS credentials to kubernetes

$(aws ecr get-login)
-- Scott Stensland
Source: StackOverflow

1/27/2016

It sounds like you don't have the appropriate IAM instance profile set on your master VM. The kube-up script for AWS creates a role and associated policy that is attached to the master VM when it is created. Having the IAM policy attached should give you the credentials necessary to make API calls into AWS.

-- Robert Bailey
Source: StackOverflow