I am trying to setup a Kubernetes cluster on my AWS account using the kube-up.sh
setup script that is bundled with kubernetes source at kubernetes/cluster/kube-up.sh
But when I ran kube-up.sh I am getting the following error:
pranjal:~/go/src/github.com/GoogleCloudPlatform/kubernetes/cluster$ ./kube-up.sh
Starting cluster using os distro: ubuntu
Starting cluster using provider: aws
... calling verify-prereqs
... calling kube-up
Uploading to Amazon S3
Creating kubernetes-staging-6b790c161af2b2c39939b542c73b775a
make_bucket failed: s3://kubernetes-staging-6b790c161af2b2c39939b542c73b775
I am sure that my the tool is not able to read my AWS Access Key and Secret. I stored it in .aws/config. I am not sure where I should set it for it to be able to read it correctly and work.
An alternative is to populate environment variables ... put following commands into a file xxxxx
export AWS_ACCESS_KEY_ID=$(cat ${AWS_ACCOUNT_CONFIGDIR}/id)
export AWS_SECRET_ACCESS_KEY=$(cat ${AWS_ACCOUNT_CONFIGDIR}/key)
then source that file prior to calling kube-up.sh
source xxxxx
kube-up.sh
aws first looks at above pair of env vars prior to probing
~/.aws/credentials
which I find makes it easier to toggle between various aws accounts
After a bit of searching I figured out a solution to the problem.
A lot of the AWS configuration goes into the config-default.sh file. However there is no option to set the Access Key ID, Secret Access Key there (which might make some sense as cluster/aws/config-default.sh file is a part of the source code and the credentials should be saved somewhere else, at a safer place)
I realized after seeing the kubernetes/cluster/aws/util.sh source code that kubernetes actually calls the aws command line tool internally to make changes to AWS infrastructure.
So having the AWS command line tool installed and configured correctly will do the job of solving this problem.
Once I issued the following command:
aws configure
and answered prompts for entering ID/Key it saved these values to this file:
~/.aws/credentials
See details here
This solved my problem and kube-up.sh worked perfectly after I did this.