超集配置在 Kubernetes pod 上丢失 start/stop

Superset configurations are lost upon Kubernetes pod start/stop

我在 Kubernetes 上遇到 Superset 问题。在 pod 关闭和启动时安装 Superset 后,配置未保存,我丢失了使用以下命令创建的管理员用户:

docker exec -it superset superset fab create-admin \
           --username admin \
           --firstname Superset \
           --lastname Admin \
           --email admin@superset.com \
           --password admin

在该命令之后,我使用的唯一命令是:

$ docker exec -it superset superset db upgrade
$ docker exec -it superset superset db upgrade
$ docker exec -it superset superset init

我正在使用 Rancher 部署 Superset pod。如何持久化配置?

对我来说,我认为你有两个选择:

  1. 为您的连播创建一个卷。您的 pod 定义看起来像这样(PS 我没有测试这段代码)
apiVersion: v1
kind: Pod
metadata:
  name: pv-recycler
  namespace: default
spec:
  restartPolicy: Never
  volumes:
  - name: vol
    hostPath:
      path: /any/path/it/will/be/replaced
  containers:
  - name: pv-recycler
    image: "superset"
    command: ["/bin/sh", "superset fab", "create-admin --username admin --firstname Superset --lastname Admin --email admin@superset.com --password admin"]
    volumeMounts:
    - name: vol
      mountPath: /scrub
  1. 制作一个 dockerfile,添加您的配置并使用您的配置构建一个新镜像

正在将解决方案从问题迁移到答案

After changing the volumes and the environment variables, and after learning how PYTHONPATH works in general, I figured it out and added my configuration file in a specific location and added that location to the PYTHONPATH environment variable. It works!