The ack-pod-identity-webhook component simplifies the use of the RAM Roles for Service Accounts (RRSA) feature of Alibaba Cloud Container Service for Kubernetes (ACK). The component automatically injects the required OpenID Connect (OIDC) token mounts and environment variable configurations into your application pods. This eliminates the need for tedious manual configuration. This topic describes the ack-pod-identity-webhook component, provides usage instructions, and includes its change log.
Introduction
The following figure shows the architecture of the ack-pod-identity-webhook component.
Example
The application deployed in this example uses the RRSA feature to assume a specified role and retrieve a list of clusters that belong to the current account. The following information is used in this example.
Namespace: rrsa-demo
Service account: demo-sa
RAM role: ack-pod-identity-webhook-demo
After you add the pod-identity.alibabacloud.com/injection: 'on'
label to the namespace where the pod resides, the ack-pod-identity-webhook component automatically injects the relevant configuration items into the pod based on the annotations of the service account that the pod uses. The procedure is as follows.
Enable the RRSA feature for your cluster. For more information, see Enable the RRSA feature.
After you enable the RRSA feature, obtain the URL and ARN of the OIDC IdP in the cluster.
Install the ack-pod-identity-webhook component.
On the Clusters page, find the cluster you want and click its name. In the left-side pane, choose .
On the Add-ons page, click the Security tab, find the ack-pod-identity-webhook component, and then click Install in the lower-right corner of the component card.
In the dialog box that appears, confirm the component information and click OK.
Create a RAM role named ack-pod-identity-webhook-demo. The following table describes the main parameters. For more information, see Create a RAM role for an OIDC IdP.
Configuration item
Description
Identity Provider Type
OIDC
Identity Provider
ack-rrsa-<cluster_id>. <cluster_id> is the ID of your cluster.
Condition
oidc:iss: Keep the default value.
oidc:aud: Keep the default value.
oidc:sub: Manually add this condition.
Key: Select oidc:sub.
Operator: Select StringEquals.
Value: system:serviceaccount:<namespace>:<serviceAccountName>. <namespace> is the namespace where the application resides. <serviceAccountName> is the name of the service account. Based on the information of the test application, enter system:serviceaccount:rrsa-demo:demo-sa.
Grant the AliyunCSReadOnlyAccess system policy to the role that you created in the previous step. This policy provides the required permissions for the test application. For more information, see Grant permissions to a RAM role.
Deploy the test application.
Create a demo.yaml file that contains the following content.
In the following YAML example, the
pod-identity.alibabacloud.com/injection: 'on'
label is added to the namespace and thepod-identity.alibabacloud.com/role-name: ack-pod-identity-webhook-demo
annotation is added to the service account to enable the automatic configuration injection feature of the ack-pod-identity-webhook component. For more information about the RRSA demo implementation, see the code.--- apiVersion: v1 kind: Namespace metadata: name: rrsa-demo labels: pod-identity.alibabacloud.com/injection: 'on' --- apiVersion: v1 kind: ServiceAccount metadata: name: demo-sa namespace: rrsa-demo annotations: pod-identity.alibabacloud.com/role-name: ack-pod-identity-webhook-demo --- apiVersion: v1 kind: Pod metadata: name: demo namespace: rrsa-demo spec: serviceAccountName: demo-sa containers: - image: registry.cn-hangzhou.aliyuncs.com/acs/ack-ram-tool:1.0.0 imagePullPolicy: "Always" args: - rrsa - demo name: demo restartPolicy: OnFailure
Run the following command to deploy the test application.
kubectl apply -f demo.yaml
Run the following command to view the test application pod and confirm that the ack-pod-identity-webhook component has automatically injected the required configurations.
kubectl -n rrsa-demo get pod demo -o yaml
The expected output indicates that the ack-pod-identity-webhook component has automatically injected the following configurations into the pod.
Category
Configuration item name
Configuration item description
Environment variable
ALIBABA_CLOUD_ROLE_ARN
The ARN of the RAM role to assume.
ALIBABA_CLOUD_OIDC_PROVIDER_ARN
The ARN of the OIDC IdP.
ALIBABA_CLOUD_OIDC_TOKEN_FILE
The file path that contains the OIDC token.
VolumeMount
rrsa-oidc-token
The configuration for mounting the OIDC token.
Volume
rrsa-oidc-token
The configuration for mounting the OIDC token.
Run the following command to view the logs of the test application.
kubectl -n rrsa-demo logs demo
Expected output:
cluster id: cf***, cluster name: foo* cluster id: c8***, cluster name: bar* cluster id: c4***, cluster name: foob*
Custom configurations
The ack-pod-identity-webhook component supports custom configurations for namespaces, service accounts, and pods.
Namespace configuration
Parameter | Type | Description | Code example |
pod-identity.alibabacloud.com/injection | Label | Specifies whether to enable automatic configuration injection for pods in this namespace.
|
|
Service account configuration
Parameter | Type | Description | Code example |
pod-identity.alibabacloud.com/role-name | Annotation | The name of the RAM role that is associated with the service account. If this configuration item is not configured or its value is not a valid RAM role name, configurations are not automatically injected into pods that use this service account. |
|
pod-identity.alibabacloud.com/service-account-token-expiration | Annotation | Specifies the validity period of the OIDC token that is mounted to the pod that uses the service account. Valid values: 600 to 43200. Unit: seconds. The default value is 3600. If you specify an invalid value, the default value is used. |
|
pod-identity.alibabacloud.com/inject-sts-endpoint | Annotation | Specifies whether to inject the
Note This parameter is supported only in version 0.3.0 and later. |
|
Pod configuration
Parameter | Type | Description | Code example |
pod-identity.alibabacloud.com/injection | Label | Specifies whether to enable automatic configuration injection for this pod.
Note This parameter is supported only in version 0.2.0 and later. |
|
pod-identity.alibabacloud.com/service-account-token-expiration | Annotation | Specifies the validity period of the OIDC token that is mounted to the pod. Valid values: 600 to 43200. Unit: seconds. The default value is 3600. If you specify an invalid value, the default value is used. Note If this configuration item exists on both the service account and the pod, the configuration on the service account is ignored. |
|
pod-identity.alibabacloud.com/only-containers | Annotation | Restricts automatic configuration injection to only containers with specific names in the pod. Use commas (,) to separate multiple container names. If this configuration item is not configured, configurations are automatically injected into all containers in the pod. |
|
pod-identity.alibabacloud.com/skip-containers | Annotation | Configures not to automatically inject configurations into containers with specific names. Use commas (,) to separate multiple container names. Note If a container name exists in both the |
|
RRSA SDK reference
Alibaba Cloud SDK V2.0 supports OIDC token authentication of RRSA. By default, all cloud service SDKs that support STS token authentication and are developed based on Alibaba Cloud SDK V2.0 support RRSA OIDC token authentication. The following table describes the supported SDK versions and demos.
Programming language | Supported SDK version | Demo |
Go | Alibaba Cloud Credentials for Go 1.2.6 and later. For more information, see Method 6: Use the RAM role of an OIDC IdP. | |
Java | Alibaba Cloud Credentials for Java 0.2.10 and later. For more information, see Method 6: Use the RAM role of an OIDC IdP. | |
Python 3 | Alibaba Cloud Credentials for Python 0.3.1 and later. For more information, see Method 6: Use the RAM role of an OIDC IdP. | |
Node.js and TypeScript | Alibaba Cloud Credentials for TypeScript/Node.js 2.2.6 and later. For more information, see Method 6: Use the RAM role of an OIDC IdP. |
Change log
September 2025
Version | Image URL | Changes | Modification Time | Impact |
0.3.1 | registry-cn-hangzhou.ack.aliyuncs.com/acs/ack-pod-identity-webhook:0.3.1 | Upgraded the Golang version used by the component to 1.24.6 to improve component stability. | September 8, 2025 | If an exception occurs during the component upgrade, pods may fail to be created. We recommend that you perform the upgrade during off-peak hours. |
June 2025
Version | Image URL | Changes | Release date | Impact |
0.3.0 | registry-cn-hangzhou.ack.aliyuncs.com/acs/ack-pod-identity-webhook:v0.3.0.0-g433f84b-aliyun | Added support for injecting the | June 6, 2025 | If an exception occurs during the component upgrade, pods may fail to be created. We recommend that you perform the upgrade during off-peak hours. |
March 2025
Version | Image URL | Changes | Release date | Impact |
0.2.1 | registry-cn-hangzhou.ack.aliyuncs.com/acs/ack-pod-identity-webhook:v0.2.1.0-g52e519c-aliyun | Upgraded the Golang version used by the component to 1.23.7 to improve component stability. | March 18, 2025 | If an exception occurs during the component upgrade, pods may fail to be created. We recommend that you perform the upgrade during off-peak hours. |
December 2024
Version | Image URL | Changes | Modified Time | Impact |
0.2.0 | registry-cn-hangzhou.ack.aliyuncs.com/acs/ack-pod-identity-webhook:v0.2.0.11-g2f0c2e7-aliyun |
| December 19, 2024 | If an exception occurs during the component upgrade, pods may fail to be created. We recommend that you perform the upgrade during off-peak hours. |
June 2023
Version | Image URL | Changes | Release date | Impact |
0.1.1 | registry.cn-hangzhou.aliyuncs.com/acs/ack-pod-identity-webhook:v0.1.1.0-gbddcb74-aliyun | Improved the compatibility of the component with ACK Serverless clusters. | June 7, 2023 | If an exception occurs during the component upgrade, pods may fail to be created. We recommend that you perform the upgrade during off-peak hours. |
February 2023
Version | Image URL | Changes | Modified | Impact |
0.1.0 | registry.cn-hangzhou.aliyuncs.com/acs/ack-pod-identity-webhook:v0.1.0.9-g26b8fde-aliyun | Implemented the feature of automatically mounting OIDC tokens and configuring environment variables for application pods. | February 1, 2023 | First version. |
References
Use RRSA to configure RAM permissions for a ServiceAccount to implement pod permission isolation