Skip to content

[Question] How to assume IAM role inside the escalator pod? Getting 403 despite instructions #231

Open
@FilipSwiatczak

Description

Hello guys,
It's a wonderful project and I've almost got it working. Having followed Readme instructions in (https://github.com/atlassian/escalator/blob/master/docs/deployment/aws/README.md)
I have those ticked off:

      ---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: escalator
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: escalator
      role: escalator
  template:
    metadata:
    # I'm really not sure all three are required as below: https://github.com/atlassian/escalator/blob/master/docs/deployment/aws/README.md#deployment
      annotations:
        iam.amazonaws.com/role: arn:aws:iam::XXX:role/bitbucket-pipelines-escalator-role
      labels:
        app: escalator
        role: escalator
    spec:
      serviceAccountName: escalator
      containers:
      - image: atlassian/escalator
        command:
        - ./main
        - --nodegroups
        - /opt/conf/nodegroups/nodegroups_config.yaml
        - --cloud-provider
        - aws
        # this bit: https://github.com/atlassian/escalator/blob/master/docs/deployment/aws/README.md#sts-assume-role
        - --aws-assume-role-arn
        - arn:aws:iam::XXX:role/bitbucket-pipelines-escalator-role
        name: escalator
        ports:
        - containerPort: 8080
        env:
        # this bit: https://github.com/atlassian/escalator/blob/master/docs/deployment/aws/README.md#aws-credentials
        - name: AWS_ROLE_ARN
          value: arn:aws:iam::XXX:role/bitbucket-pipelines-escalator-role
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: AWS_REGION
          value: eu-west-1
        volumeMounts:
        - name: escalator-nodegroups
          mountPath: /opt/conf/nodegroups
          readOnly: true

Given all that I'm still getting 403 on attempt to assume role.
AccessDenied: User: arn:aws:sts::XXX:assumed-role/eksctl-bitbucketpipelines-nodegro-NodeInstanceRole-XXX is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::XXX:role/bitbucket-pipelines-escalator-role\n\tstatus code: 403

  1. I am missing something? Is the documentation complete?
  2. Other sources suggest creating OIDC Provider for the cluster (https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html) I've done that with eksctl and it has no impact on it's own
  3. Is there a specific trust relationship on the IAM role required before the escalator pod can assume it please?

Any pointers would be much appreciated. Thank you!

Activity

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

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions