Adding a VCF package repository on a VKS Workload cluster fails with authorization errors. The executing user is the namespace owner and possesses a ClusterRoleBinding with cluster-admin privileges.
Error: packagerepositories.packaging.carvel.dev "standard-package-repo" is forbidden: User "sso:[email protected]" cannot get resource "packagerepositories" in API group "packaging.carvel.dev" in the namespace "tkg-system"
VMware Cloud Foundation 9.0
VMware Kubernetes Service
The package repository addition command is executed with the sudo elevation prefix. This causes the CLI to execute as the local root user, which lacks a valid Kubernetes context for the session, resulting in API authorization failure for example.
sudo vcf package repository add standard-package-repo --url projects.packages.broadcom.com/vsphere/supervisor/packages/2025.8.19/vks-standard-packages:v2025.8.19 -n tkg-system