Created
February 5, 2019 04:36
-
-
Save callum-p/cc00c48002a5c016eadba073f8f87ff7 to your computer and use it in GitHub Desktop.
Revisions
-
callum-p revised this gist
Feb 5, 2019 . 1 changed file with 21 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ { "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com" }, "Action": "sts:AssumeRole" }, { "Sid": "", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::$AWS_ACCOUNT_ID:role/$KIAM_ROLE_NAME" }, "Action": "sts:AssumeRole" } ] } -
callum-p created this gist
Feb 5, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ # annotate namespace kube-system and default to allow iam role assumptions kubectl annotate namespace kube-system iam.amazonaws.com/permitted=".*" --overwrite kubectl annotate namespace default iam.amazonaws.com/permitted=".*" --overwrite # setup json policies with variables envsubst '$AWS_ACCOUNT_ID $CLUSTER_NAME' < ./.docker/scripts/addons/kiam/trust.json.tpl > ./.docker/scripts/addons/kiam/trust.json # create kiam server role if it doesn't exist while ! aws iam get-role --role-name masters.$CLUSTER_NAME; do echo "Waiting for masters role to be created..." sleep 5 done aws iam get-role --role-name $KIAM_ROLE_NAME > /dev/null || \ aws iam create-role --role-name $KIAM_ROLE_NAME --assume-role-policy-document file://./.docker/scripts/addons/kiam/trust.json # update the kiam trust policy in case it already exists aws iam update-assume-role-policy --role-name $KIAM_ROLE_NAME --policy-document file://./.docker/scripts/addons/kiam/trust.json # assign the kiam iam policy to the role aws iam put-role-policy --role-name $KIAM_ROLE_NAME --policy-name kiam --policy-document file://./.docker/scripts/addons/kiam/kiam_server_policy.json This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sts:AssumeRole" ], "Resource": [ "*" ] } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ { "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com" }, "Action": "sts:AssumeRole" }, { "Sid": "", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/masters.$CLUSTER_NAME" }, "Action": "sts:AssumeRole" } ] }