我试图将示例应用程序推送到Knative,但是我遇到以下错误消息:
Revision "..." failed with message: Unable to fetch image "...": unsupported status code 401; body: Not Authorized
Knative已在EC2上正确设置,并且我已经创建了一个服务帐户和要从ECR中提取的密码。我想念什么?我不确定即使K8(而非Knative)能够访问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>
原始秘密:
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
本地配置:
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: "..."