Open toddatapiture opened 3 years ago
I have the same issue here.
Jenkins version: 2.452.3
Pipeline: AWS Steps Plugin version: 1.45
AWS EC2 Linux/UNIX
Jenkins agent pod template definition
---
apiVersion: v1
kind: Pod
metadata:
namespace: jenkins-agents
spec:
containers:
- name: ami-builder
image: private-docker-registry/ami-builder:0.0.1-snapshot
imagePullSecrets:
- name: secret-name
serviceAccount: jenkins-agent-ami-builder
serviceAccountName: jenkins-agent-ami-builder
The ServiceAccount
present on the namespace:
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/managed-by: Helm
name: jenkins-agent-ami-builder
namespace: jenkins-agents
And finally in AWS we have:
An IAM Role xxxxxxxxxxxx
with the following attached IAM Policy:
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Resource": [
"arn:aws:iam::YYYYYYYYYYYY:role/RoleNameFromYYYYYYYYYYYY"
],
"Sid": "AssumeRole"
}
],
"Version": "2012-10-17"
}
And also on the EKS we have created the Pod Identity association which link the IAM Role arn:aws:iam::xxxxxxxxxxxx:role/RoleName
with ServiceAccount
(jenkins-agent-ami-builder
) from the desired namespace jenkins-agents
Error
com.amazonaws.services.securitytoken.model.AWSSecurityTokenServiceException: User: arn:aws:sts::xxxxxxxxxxxx:assumed-role/worker-main-az-eks-node-group-zzzzzzzzzzzzzzzzz is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::yyyyyyyyyyyy:role/RoleName (Service: AWSSecurityTokenService; Status Code: 403; Error Code: AccessDenied; Request ID: aaaaaaaaaaaaaaaaaaaaaaaaaa; Proxy: null)
Version report
Jenkins and plugins versions report:
Reproduction steps
Expected result:
Actual result: