-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(eks): EKS ALB Controller cannot provision ALB with OIDC configuration #33223
Comments
Hi @markusl Can you share your minimal CDK code? Looks like we'll need to grant secret read privileges and I am not sure if aws-eks L2 should handle that. Having the visibility of your CDK code snippet would help. |
@pahud "normal" ALB can provisioned just fine with the following code: const cluster = new eks.Cluster(this, `${clusterName}-cluster`, {
vpc: vpc,
clusterName: clusterName,
version: eks.KubernetesVersion.V1_31,
albController: {
version: eks.AlbControllerVersion.V2_8_2,
},
}); However, when using apiVersion: v1
kind: Secret
metadata:
namespace: testcase
name: my-k8s-secret
data:
clientID: base64 of your plain text clientId
clientSecret: base64 of your plain text clientSecret Reading the secret fails with the default settings of |
Thank you. aws-cdk/packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts Lines 315 to 330 in 6fa1d05
Sounds like we need to allow the serviceAccount to access that secret but I am not pretty sure what is the best action we need to do from CDK. Can you find any document about how to install the alb controller with OIDC support without using CDK? I guess we need to first find out what's the correct steps before we could figure out what CDK can do here. |
@pahud it turns something like this can be used as a workaround: # secrets-access.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: secrets-access
namespace: app-namespace
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: secrets-access-binding
namespace: app-namespace
subjects:
- kind: ServiceAccount
name: aws-load-balancer-controller
namespace: kube-system
roleRef:
kind: Role
name: secrets-access
apiGroup: rbac.authorization.k8s.io If it turns out to be difficult to implement, at least the limitation should be documented in AlbController, and preferably a convenience method could be added to easily attach the required resources if user is using ALB + OIDC. Thank you! |
Absolutely. Do you think this deserves a PR for aws-eks README update? |
@pahud Yep, I think this should be documented as a corner case that if AlbController is used with ALBs that have OIDC configured, then the user must grant access to the secrets manually. |
Describe the bug
AlbController cannot provision ALB with OIDC configuration:
User "system:serviceaccount:kube-system:aws-load-balancer-controller" cannot get resource "secrets" in API group
.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
ALB Controller can be used to provision ALB's
Current Behavior
Reproduction Steps
Possible Solution
Please add the required permissions for it to work :) Is there any workaround for this?
Additional Information/Context
No response
CDK CLI Version
2.177.0 (build b396961)
Framework Version
No response
Node.js Version
v22.13.0
OS
Mac
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: