【发布时间】:2021-03-07 12:56:02
【问题描述】:
我在 Dockerfile 中安装了 gsutil,如下所示:
FROM postgres
RUN apt-get update -y
RUN apt-get install -y curl python && curl -sSL https://sdk.cloud.google.com | bash
ENV PATH $PATH:/root/google-cloud-sdk/bin
然后将其作为容器部署在以下 Pod 中:
apiVersion: v1
kind: Pod
metadata:
name: postgresql-backup
spec:
containers:
- name: web
image: xxx/posgresql-backup:latest
ports:
- name: web
containerPort: 80
protocol: TCP
command: ['sh', '-c', 'echo The app is running! && sleep 36000']
请注意,在我的例子中,容器正在默认服务帐户下执行:111111111-compute@developer.gserviceaccount.com
我之前创建了一个名为:posgresql-backup 的存储桶
当我在执行容器中打开终端时:kubectl exec -it xxx -- /bin/bash
如果我运行gsutil ls gs://posgresql-backup,它会返回该存储桶中的文件列表:
gs://posgresql-backup/dump1.sql
但是,当我尝试将文件从容器 cp 到存储桶 gsutil cp myfile.txt gs://posgresql-backup 时:
AccessDeniedException: 403 Insufficient Permission
在存储桶权限中,我将服务帐户添加为存储管理员和存储对象管理员,但没有任何区别。
我还缺少什么?
【问题讨论】:
标签: google-cloud-platform google-cloud-storage google-kubernetes-engine gsutil