[BUG] Istio add-on plugin CA rotation never reaches istiod on AKS Automatic: secrets provider rotation is denied a token for istiod's service account
Describe the bug
On AKS Automatic with the Istio service mesh add-on configured with a plugin CA from Azure Key Vault, updating the CA secrets in Key Vault never reaches istiod. The Key Vault secrets provider's rotation controller is refused a service account token for istiod's service account, so the CSI mount stays on the old secret versions. The customer also can't restart, delete or evict the istiod pods, because AKS-managed admission policies block it. The documented rotation procedure (https://learn.microsoft.com/azure/aks/istio-plugin-ca#certificate-authority-rotation) therefore can't be completed.
To Reproduce
- Create an AKS Automatic cluster. The Key Vault secrets provider add-on is enabled by default, with
enableSecretRotation: true. - Put a root cert, an intermediate cert and key, and a cert chain in Key Vault as secrets. Grant the add-on identity (
azurekeyvaultsecretsprovider-<cluster>)Key Vault Secrets User. - Enable the mesh with
serviceMeshProfile.istio.certificateAuthority.pluginpointing at those four secrets (asm-1-31,CNIChaining). istiod loads the intermediate and workloads are issued certs from it, as expected. - Update the four secrets in Key Vault with a new intermediate signed by the same root (same secret names, new versions).
- Wait. After 20+ minutes istiod is still signing with the old intermediate.
Expected behavior
Within the rotation poll interval (2 minutes), the CSI driver refreshes istiod's cacerts mount, and istiod reloads the new intermediate, as the plugin CA docs describe.
Actual behavior
The CSI driver's rotation controller fails every 10 seconds (kube-system/aks-secrets-store-csi-driver-*, container secrets-store):
E1029 12:14:21.264556 1 reconciler.go:237] "failed to reconcile spc for pod" err="failed to get service account token attrs, err: failed to fetch token: serviceaccounts \"istiod-asm-1-31\" is forbidden: User \"system:serviceaccount:kube-system:aks-secrets-store-csi-driver\" cannot create resource \"serviceaccounts/token\" in API group \"\" in the namespace \"aks-istio-system\": This service account has AKS platform privileges. Token creation is restricted to trusted platform identities." spc="istio-spc-asm-1-31" pod="istiod-asm-1-31-7d577f77cf-29lz7" controller="rotation"
SecretProviderClassPodStatus for both istiod pods keeps the original object versions, while Key Vault holds newer versions of all four secrets.
istiod's log shows its last CA load came from pod start, before the Key Vault update:
info x509 cert - Issuer: "CN=<root>,O=<org>", Subject: "CN=<intermediate-v2>,O=<org>,L=<cluster>", SN: ...
The customer has no way to force a remount (server-side dry runs, nothing changed):
# kubectl rollout restart deploy/istiod-asm-1-31 (as a restartedAt patch)
deployments.apps "istiod-asm-1-31" is forbidden: ValidatingAdmissionPolicy 'aks-managed-critical-addons-only' with binding 'aks-managed-critical-addons-only-binding' denied request: Toleration with key 'CriticalAddonsOnly' is not allowed. This key is reserved for critical system components only.
# kubectl delete pod, and the eviction API
pods "istiod-asm-1-31-7d577f77cf-29lz7" is forbidden: ValidatingAdmissionPolicy 'aks-managed-protect-system-namespaces' with binding 'aks-managed-protect-system-namespaces-binding' denied request: Modification of resources in managed system namespaces is not allowed
Changing the secret names in certificateAuthority.plugin succeeds, and AKS updates SecretProviderClass/istio-spc-asm-1-31 to the new names. istiod still isn't remounted or restarted.
Workaround
Deleting the NAP NodeClaim under each istiod pod makes Karpenter drain the node. The replacement istiod pods mount the latest secret versions and load the new intermediate, and workloads move over as their certificates renew. Old and new workload certs interoperate while they share a root. This disrupts every workload on those nodes, so it's not a reasonable rotation procedure.
Environment
- AKS Automatic, Standard tier, Sweden Central, Kubernetes 1.36.5
- Istio add-on
asm-1-31,proxyRedirectionMechanism: CNIChaining, plugin CA from Key Vault (RBAC authorization) - Key Vault secrets provider add-on,
enableSecretRotation: true mcr.microsoft.com/oss/v2/kubernetes-csi/secrets-store/driver:v1.5.7-6, args include--enable-secret-rotation=true --rotation-poll-interval=2mmcr.microsoft.com/oss/v2/azure/secrets-store/provider-azure:v1.8.2-16
Ask
Either allow the secrets provider's rotation controller to request tokens for the Istio add-on's own service account on AKS Automatic, or provide a supported way to roll istiod after a plugin CA change (for example an az aks mesh operation, or having AKS roll istiod when certificateAuthority.plugin changes). If plugin CA rotation is intentionally unsupported on AKS Automatic, please document it on the plugin CA page.
@therealmitchconnors would you be able to assist?
Theres a workaround to this that does kind of work at the tradeoff of injecting increased node recycling, that is to set nodepool expiration as per https://learn.microsoft.com/en-us/azure/aks/node-auto-provisioning-disruption any sensible non-default (default = no expiration) value would work here. but its important that all your workloads are configured to handle that gracefully - E.g. replica counts, disruption budgets etc