-
Notifications
You must be signed in to change notification settings - Fork 624
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
[Azure] Using Service Principal credentials to pull private image in ACR #192
Comments
Thank you for all the detail! The AD service principle creds do not get passed down to ACI so your workaround to create a secret is the recommended way to pull from ACR. I agree you shouldn't need to think about where your pod is running ACI vs. in cluster so in the future we will figure out how to enable that workflow. |
Thanks @rbitia! It's great to have that clarification. |
Could I make a request that you add a note to the existing virtual kubelet documentation about needing to add a kubernetes secret to the pod spec? Would have saved me a fair amount of time today. |
I believe this issue has been addressed. Closing |
Environment summary
Provider (e.g. ACI, AWS Fargate, Hyper)
ACI
Version (e.g. 0.1, 0.2-beta)
microsoft/virtual-kubelet:latest
(aka. 0.2-beta-12)K8s Master Info (e.g. AKS, ACS, Bare Metal, EKS)
AKS
Install Method (e.g. Helm Chart)
az aks install-connector [...]
Issue Details
When specifying a private image hosted on an ACR (Azure Container Registry), the Azure AD Service Principal authentication credentials are not passed to the ACI. Private images work totally fine if the pods are run on the AKS nodes, but do not behave the same way using virtual-kubelet - I naively expect the same result regardless of where the underlying pod is running.
As a workaround I have created a secret (of type
kubernetes.io/dockerconfigjson
) which contains the Service Credentials details needed to pull the private image from ACR (username/appId and password). And I point the spec at the secret (viaimagePullSecrets
). As I took a look through the provider code and noticed that it supported this feature (see below).virtual-kubelet/providers/azure/aci.go
Lines 444 to 472 in f3ebde2
I could not find any other references that would suggest these credentials could be automatically passed to ACI. But for the time being, my workaround functions as expected - I'm not just entirely sure if it's the best way to do it.
I also noticed that when specifying multiple auths (eg.
https://example.azurecr.io
andexample.azurecr.io
) in the docker config json secret, ACI also throws an error. So this workaround requires a secret per container registry (which is probably a good idea anyway) - if you're pulling from multiple ACRs. I'm not, but it's worth noting, because the code below suggests that you could provide multiple auths, yet I'm not sure that could ever work.virtual-kubelet/providers/azure/aci.go
Lines 520 to 526 in f3ebde2
I hope that's enough info.
Repo Steps
Reader
role to the SP)example.azurecr.io/nginx:latest
).Example JSON output from the resource group's activity log:
The text was updated successfully, but these errors were encountered: