high-garage-86992
09/16/2022, 5:22 PMflytectl sandbox start
I created a secrets file acr-secrets-flytesnacks-development.yaml
apiVersion: v1
data:
.dockerconfigjson: ***Base64 encoded json***
kind: Secret
metadata:
name: acr-pull-credentials
namespace: flyte-development
type: <http://kubernetes.io/dockerconfigjson|kubernetes.io/dockerconfigjson>
I applied the secret in the project-domain namespace with
kubectl -n flytesnacks-development apply -f secrets/acr-secrets-flytesnacks-development.yaml
I patched the default service account within the project-domain namespace :
kubectl -n flytesnacks-development patch serviceaccount default -p '{"imagePullSecrets": [{"name": "acr-pull-credentials"}]}'
I run my workflow with
pyflyte run --remote --image ***.<http://azurecr.io/databricks_workflow:latest|azurecr.io/databricks_workflow:latest> databricks_wf.py databricks_workflow --sql 'select...'
The pods get stuck in pending and describe shows the following issue:
Failed to pull image "***.<http://azurecr.io/databricks_workflow:latest|azurecr.io/databricks_workflow:latest>": rpc error: code = Unknown desc = Error response from daemon: Head "https://*****.<http://azurecr.io/v2/databricks_workflow/manifests/latest|azurecr.io/v2/databricks_workflow/manifests/latest>": unauthorized: authentication required, visit <https://aka.ms/acr/authorization> for more information.
Placing the decoded secret in .docker/config.json allows docker pull
to work locally. Thanks for a any suggestions!thankful-minister-83577
thankful-minister-83577
-o yaml
for the pod and grep for pull secrets?high-garage-86992
09/16/2022, 9:00 PMthankful-minister-83577
thankful-minister-83577
kubectl get -n flytesnacks-development get pod <pod_name> -o yaml
thankful-minister-83577
thankful-minister-83577
-o yaml
switch on the default serviceaccountthankful-minister-83577
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: 2015-08-07T22:02:39Z
name: default
namespace: default
uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6
imagePullSecrets:
- name: myregistrykey
thankful-minister-83577
high-garage-86992
09/16/2022, 9:07 PMapiVersion: v1
imagePullSecrets:
- name: acr-pull-credentials
kind: ServiceAccount
metadata:
creationTimestamp: "2022-09-16T14:31:27Z"
name: default
namespace: flytesnacks-development
resourceVersion: "5798"
uid: dde5ad00-83f2-4f20-8c17-86d92f6a4001
secrets:
- name: default-token-9lvqx
high-garage-86992
09/16/2022, 9:09 PMget pod
for the stuck pod:
imagePullSecrets:
- name: acr-pull-credentials
nodeName: 9a8ded8a5390
thankful-minister-83577
thankful-minister-83577
thankful-minister-83577
thankful-minister-83577
kubectl create -f file.yaml
apiVersion: v1
kind: Pod
metadata:
name: debugpod
namespace: flytesnacks-development
spec:
serviceAccount: default
serviceAccountName: default
imagePullSecrets:
- name: acr-pull-credentials
containers:
- args:
- sleep
- infinity
image: <http://blah.azurecr.io/databricks_workflow:latest|blah.azurecr.io/databricks_workflow:latest>
imagePullPolicy: IfNotPresent
name: abc
thankful-minister-83577
high-garage-86992
09/16/2022, 9:36 PMhigh-garage-86992
09/16/2022, 9:38 PMdebugpod
I'm going to check the credentials again. I think that my docker config might have been updated by the az cli between when I pasted in the credentials and when I ran docker pull
. Maybe they are actually misformatted.high-garage-86992
09/16/2022, 9:49 PMthankful-minister-83577
thankful-minister-83577
high-garage-86992
09/16/2022, 9:54 PMthankful-minister-83577
thankful-minister-83577
thankful-minister-83577
thankful-minister-83577
kubectl create secret docker-registry <secret-name> \
--namespace <namespace> \
--docker-server=<container-registry-name>.<http://azurecr.io|azurecr.io> \
--docker-username=<service-principal-ID> \
--docker-password=<service-principal-password>
high-garage-86992
09/16/2022, 9:58 PMapiVersion: v1
data:
.dockerconfigjson: ***Base64 encoded json***
kind: Secret
metadata:
name: acr-pull-credentials
namespace: flyte-development
type: <http://kubernetes.io/dockerconfigjson|kubernetes.io/dockerconfigjson>
thankful-minister-83577
high-garage-86992
09/16/2022, 10:00 PMauths
<http://address.acr.io|address.acr.io>
auth
identitytoken
thankful-minister-83577
thankful-minister-83577
high-garage-86992
09/16/2022, 10:03 PMthankful-minister-83577
thankful-minister-83577
high-garage-86992
09/16/2022, 10:05 PMhigh-garage-86992
09/16/2022, 10:14 PMhigh-garage-86992
09/16/2022, 10:18 PMthankful-minister-83577
tall-lock-23197
incalculable-zebra-90365
09/20/2022, 5:36 AMtall-lock-23197
high-garage-86992
09/21/2022, 11:58 PMincalculable-zebra-90365
09/26/2022, 8:30 AMhigh-garage-86992
09/26/2022, 1:07 PMincalculable-zebra-90365
09/26/2022, 1:53 PMincalculable-zebra-90365
09/28/2022, 8:20 AMincalculable-zebra-90365
09/28/2022, 8:21 AM{{- with .Values.createImagePullSecrets }}
{{- range $secretName, $secret := . }}
---
apiVersion: v1
kind: Secret
type: <http://kubernetes.io/dockerconfigjson|kubernetes.io/dockerconfigjson>
metadata:
name: {{ $secretName }}
{{- if $secret.annotations }}
annotations: {{- toYaml $secret.annotations | nindent 4 }}
{{- end }}
{{- if $secret.labels }}
labels: {{- toYaml $secret.labels | nindent 4 }}
{{- end }}
data:
.dockerconfigjson: {{ template "imagePullSecret" $secret }}
{{- end }}
{{- end }}
where template "imagePullSecret"
would be:
{{- define "imagePullSecret" }}
{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password (printf "%s:%s" .username .password | b64enc) | b64enc }}
{{- end }}
incalculable-zebra-90365
09/28/2022, 8:23 AMapiVersion: v1
kind: Secret
type: <http://kubernetes.io/dockerconfigjson|kubernetes.io/dockerconfigjson>
metadata:
name: azure-acr-bshrkmain-access
data:
.dockerconfigjson: <base64>
when decoding the .dockerconfigjson
value, it'll have the following structure:
{
"auths": {
"<REGISTRY>": {
"username": "<USERNAME>",
"password": "<PASSWORD>",
"auth": "<BASE64 OF USERNAME:HASH>"
}
}
}
incalculable-zebra-90365
09/28/2022, 8:33 AMdefault
service account in each flyte namespace has said image pull secret attached:
apiVersion: v1
kind: ServiceAccount
metadata:
name: default
namespace: <NAMESPACE>
secrets:
- name: <DEFAULT TOKEN>
imagePullSecrets:
- name: <IMAGE PULL SECRET NAME>
incalculable-zebra-90365
09/28/2022, 8:54 AMhigh-garage-86992
09/29/2022, 10:05 PMincalculable-zebra-90365
09/30/2022, 6:53 AMidentitytoken
?high-garage-86992
10/03/2022, 6:31 PMidentitytoken
. I get the same authorization message. So not a Flyte issue. I am able to pull the same image using docker inside the local sandbox container. My guess is that identitytoken
doesn't work with k3s, but not sure.incalculable-zebra-90365
10/04/2022, 12:33 PMidentitytoken
wouldn't work...