docker - 如何在气流的 KubernetesPodOperator 中使用 --privileged 运行 docker 映像
问题描述
如何使用在 GCP 中的 Container Registry 中使用
Running this docker run
local 进行私有映像工作正常:--privileged
docker run -it --privileged --entrypoint /bin/bash ${GKE_APP}
我跟着这个,但错误仍然存在。
这是我的 DAG:
def process_backup_data(data_to_backup):
secret_file = Secret('volume', '/etc/secrets', 'my-secret')
task_env_vars = {'GOOGLE_APPLICATION_CREDENTIALS': "/etc/secrets/my-sa.json}
security_context = {
'privileged': True,
'allow_privilege_escalation': True,
'capabilities': {'add': ['SYS_ADMIN']}
}
return KubernetesPodOperator(image="asia.gcr.io/my-image:latest",
env_vars=task_env_vars,
cmds=["sh", "run-vpn-script.sh"],
arguments=[data_to_backup],
labels={"project": "my-project"},
name="my-project-backup-datasets",
task_id=f"backup_{task_id}",
dag=dag,
secrets=[secret_file],
image_pull_policy='Always',
security_context=security_context # HERE
)
解决方案
您是否检查过您是否缺少某种能力?
我在您发布的示例中看到他们还将其添加到security_context
'capabilities': {'add': ['SYS_ADMIN']}
推荐阅读
- css - Iphone 5 的标题 CSS
- javascript - Mongodb查找最高的两个考试分数
- python - 如何找到 Matplotlib 文本对象的旋转锚点(用于自动调整刻度标签或其他文本对象的大小)?
- sql - 如何将一个oracle数据库表中的选定数据列实时插入到另一个oracle数据库表中
- c - 向/从子进程发送和接收文本
- javascript - 使用 for of 循环创建 3 个数组的组合
- python - Python Keras ValueError:数据基数不明确
- integromat - Webhook - 验证 - 验证是否允许 POST 请求的 OPTIONS 方法 - Integromat SDK
- c++ - 为什么你会为你将通过 std::vector 引用的对象使用堆分配?
- python - 是否可以在子类中将数据属性分配给超类?