Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have terraform setup K8sProvider role #105

Closed
frickjack opened this issue Nov 10, 2017 · 0 comments · Fixed by #113
Closed

Have terraform setup K8sProvider role #105

frickjack opened this issue Nov 10, 2017 · 0 comments · Fixed by #113

Comments

@frickjack
Copy link
Contributor

and stop providing user aws keys as part of terraform config, and stop copying user aws keys to the k8s provider vm

From https://cdis.slack.com/files/U6R4GAN0H/F7Y018BQA/Setup_K8s_IAM_Roles_:

Currently we run kube-aws with personal AWS credentials that we upload to the kube provisioner via kube-up.sh:

mkdir -p ~/.aws
...
mv credentials ~/.aws

However - AWS allows us to assign a "role" to an EC2 instance which exposes temporary credentials to applications via a metadata service that the AWS SDK's (and kube-aws I'm pretty sure) hook into if credentials are not otherwise provided:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#instance-metadata-security-credentials
http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html

For example - kube-aws assigns a role the the k8 nodes, so we can fetch a temporary key for that role by querying a node's metadata service:

$ kubectl exec gdcapi-deployment-3057747319-qpt77 curl http://169.254.169.254/latest/meta-data/iam/security-credentials/planxplanetv1-Nodepool-4VY43DV1ISHF-IAMRoleWorker-158QBVD5WMYA7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 894 100 894 0 0 1064k 0 --:--:-- --:--:-- --:--:-- 873k
{
"Code" : "Success",
"LastUpdated" : "2017-11-09T22:01:42Z",
"Type" : "AWS-HMAC",
"AccessKeyId" :

First, I would like to extend terraform to assign a 'KubeProvider' role to the kube provider EC2 instance with admin permissions, and remove the code that installs the ~/.aws/credentials of whoever ran terraform, so that kube-aws and the aws-cli will run with the 'KubeProvider' role.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant