我正在尝试将示例申请推向knative,但是我遇到了以下错误消息:
Revision "..." failed with message: Unable to fetch image "...": unsupported status code 401; body: Not Authorized
knative是在EC2上正确设置的,我已经创建了一个服务帐户和秘密,可以从ECR中提取。我想念什么?我不确定Knative为什么即使K8(不是Knative(能够访问我的私人AWS存储库。
秘密:
apiVersion: v1
kind: Secret
metadata:
name: registry-push-secret
annotations:
build.knative.dev/docker-0: https://....
type: kubernetes.io/basic-auth
stringData:
username: token
password: <token_value>
knative秘密:
kubectl create secret docker-registry secret-name --docker-server=https://... --docker-username=token --docker-password=<token_value>
服务帐户:
apiVersion: v1
kind: ServiceAccount
metadata:
name: test-sa
secrets:
- name: registry-push-secret
imagePullSecrets:
- name: secret-name
knative config:
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: test
namespace: default
spec:
runLatest:
configuration:
revisionTemplate:
spec:
serviceAccountName: test-sa
container:
image: ...
imagePullPolicy: Always
env:
- name: TARGET
value: "..."
对于任何偶然发现的人,它最终在GitHub问题中得到解决:https://github.com/knative/serving/serving/serving/issues/1996