使用 postgresql 在 K8s 中配置超集的问题
Configuration issues with superset in K8s with postgresql
我正在尝试使用 k8s 安装超集,PostgreSQL 作为后端数据库,redis 作为缓存层。
Superset 已启动并且 运行ning 但是当我尝试 运行 SQL 查询时,出现以下错误
第 dbs.server_cert 列不存在于字符 814
下面是我的配置文件和 helm 模板。感谢任何帮助,谢谢!
# Source: superset/templates/secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: superset
labels:
app: superset
chart: superset-1.1.11
release: superset
heritage: Helm
namespace: test
type: Opaque
data:
superset_config.py: "attached seperately"
---
# Source: superset/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
name: superset
labels:
app: superset
chart: superset-1.1.11
release: superset
heritage: Helm
namespace: test
spec:
type: ClusterIP
ports:
- name: http
port: 9000
targetPort: 8088
protocol: TCP
selector:
app: superset
release: superset
---
# Source: superset/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: superset
labels:
app: superset
chart: superset-1.1.11
release: superset
heritage: Helm
namespace: test
spec:
replicas: 1
selector:
matchLabels:
app: superset
release: superset
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
name: superset
labels:
app: superset
chart: superset-1.1.11
release: superset
heritage: Helm
annotations:
checksum/secrets: 6dd9c87c415d8a5a00981f36d8dca6ad69a2fdeae29d0caa3a02633be4acff07
spec:
securityContext:
runAsUser: 1000
fsGroup: 1000
volumes:
- name: superset-configs
secret:
secretName: superset
- name: storage-volume
persistentVolumeClaim:
claimName: superset-storage
containers:
- env:
- name: PYTHONPATH
value: "${PYTHONPATH}:/home/superset/superset/"
image: amancevice/superset:0.36.0
name: superset
volumeMounts:
- name: superset-configs
mountPath: /home/superset/superset
- name: storage-volume
mountPath: /var/lib/superset
ports:
- name: http
containerPort: 8088
protocol: TCP
livenessProbe:
failureThreshold: 2
httpGet:
path: /health
port: http
initialDelaySeconds: 80
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
failureThreshold: 2
httpGet:
path: /health
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
---
#PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: superset-storage
namespace: test
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
超集配置文件
import os
def get_env_variable(var_name, default=None):
"""Get the environment variable or raise exception.
Args:
var_name (str): the name of the environment variable to look up
default (str): the default value if no env is found
"""
try:
return os.environ[var_name]
except KeyError:
if default is not None:
return default
raise RuntimeError(
'The environment variable {} was missing, abort...'
.format(var_name)
)
# Postgres
POSTGRES_USER = '**'
POSTGRES_PASSWORD = '**'
POSTGRES_HOST = '**'
POSTGRES_PORT = '**'
POSTGRES_DB = '**'
SQLALCHEMY_DATABASE_URI = 'postgresql://{0}:{1}@{2}:{3}/{4}'.format(
POSTGRES_USER,
POSTGRES_PASSWORD,
POSTGRES_HOST,
POSTGRES_PORT,
POSTGRES_DB,
)
# Redis
REDIS_HOST = '**'
REDIS_PORT = '**'
# Celery
class CeleryConfig:
BROKER_URL = 'redis://{0}:{1}/0'.format(REDIS_HOST, REDIS_PORT)
CELERY_IMPORTS = ('superset.sql_lab',)
CELERY_RESULT_BACKEND = 'redis://{0}:{1}/1'.format(REDIS_HOST, REDIS_PORT)
CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}}
CELERY_TASK_PROTOCOL = 1
CELERY_CONFIG = CeleryConfig
FLASK_APP=superset
错误
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column dbs.server_cert does not exist
LINE 1: ...rm, dbs.impersonate_user AS dbs_impersonate_user, dbs.server...
^
[SQL: SELECT dbs.created_on AS dbs_created_on, dbs.changed_on AS dbs_changed_on, dbs.id AS dbs_id, dbs.verbose_name AS dbs_verbose_name, dbs.database_name AS dbs_database_name, dbs.sqlalchemy_uri AS dbs_sqlalchemy_uri, dbs.password AS dbs_password, dbs.cache_timeout AS dbs_cache_timeout, dbs.select_as_create_table_as AS dbs_select_as_create_table_as, dbs.expose_in_sqllab AS dbs_expose_in_sqllab, dbs.allow_run_async AS dbs_allow_run_async, dbs.allow_csv_upload AS dbs_allow_csv_upload, dbs.allow_ctas AS dbs_allow_ctas, dbs.allow_dml AS dbs_allow_dml, dbs.force_ctas_schema AS dbs_force_ctas_schema, dbs.allow_multi_schema_metadata_fetch AS dbs_allow_multi_schema_metadata_fetch, dbs.extra AS dbs_extra, dbs.encrypted_extra AS dbs_encrypted_extra, dbs.perm AS dbs_perm, dbs.impersonate_user AS dbs_impersonate_user, dbs.server_cert AS dbs_server_cert, dbs.created_by_fk AS dbs_created_by_fk, dbs.changed_by_fk AS dbs_changed_by_fk
FROM dbs ORDER BY dbs.changed_on DESC
LIMIT %(param_1)s]
应用此配置后,我对 pod 执行了一个 exec 并 运行 以下命令:
- 超集数据库升级
- 超集初始化
迁移似乎没有成功完成。尝试在超集容器内执行以下命令
superset db upgrade
为了执行迁移。
尽管如此,您不必在容器中手动执行命令来使其正常工作。超集 helm chart 接受一个 initFile
作为值来实现这一点,而无需手动执行到容器中。
我正在尝试使用 k8s 安装超集,PostgreSQL 作为后端数据库,redis 作为缓存层。
Superset 已启动并且 运行ning 但是当我尝试 运行 SQL 查询时,出现以下错误
第 dbs.server_cert 列不存在于字符 814
下面是我的配置文件和 helm 模板。感谢任何帮助,谢谢!
# Source: superset/templates/secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: superset
labels:
app: superset
chart: superset-1.1.11
release: superset
heritage: Helm
namespace: test
type: Opaque
data:
superset_config.py: "attached seperately"
---
# Source: superset/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
name: superset
labels:
app: superset
chart: superset-1.1.11
release: superset
heritage: Helm
namespace: test
spec:
type: ClusterIP
ports:
- name: http
port: 9000
targetPort: 8088
protocol: TCP
selector:
app: superset
release: superset
---
# Source: superset/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: superset
labels:
app: superset
chart: superset-1.1.11
release: superset
heritage: Helm
namespace: test
spec:
replicas: 1
selector:
matchLabels:
app: superset
release: superset
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
name: superset
labels:
app: superset
chart: superset-1.1.11
release: superset
heritage: Helm
annotations:
checksum/secrets: 6dd9c87c415d8a5a00981f36d8dca6ad69a2fdeae29d0caa3a02633be4acff07
spec:
securityContext:
runAsUser: 1000
fsGroup: 1000
volumes:
- name: superset-configs
secret:
secretName: superset
- name: storage-volume
persistentVolumeClaim:
claimName: superset-storage
containers:
- env:
- name: PYTHONPATH
value: "${PYTHONPATH}:/home/superset/superset/"
image: amancevice/superset:0.36.0
name: superset
volumeMounts:
- name: superset-configs
mountPath: /home/superset/superset
- name: storage-volume
mountPath: /var/lib/superset
ports:
- name: http
containerPort: 8088
protocol: TCP
livenessProbe:
failureThreshold: 2
httpGet:
path: /health
port: http
initialDelaySeconds: 80
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
failureThreshold: 2
httpGet:
path: /health
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
---
#PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: superset-storage
namespace: test
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
超集配置文件
import os
def get_env_variable(var_name, default=None):
"""Get the environment variable or raise exception.
Args:
var_name (str): the name of the environment variable to look up
default (str): the default value if no env is found
"""
try:
return os.environ[var_name]
except KeyError:
if default is not None:
return default
raise RuntimeError(
'The environment variable {} was missing, abort...'
.format(var_name)
)
# Postgres
POSTGRES_USER = '**'
POSTGRES_PASSWORD = '**'
POSTGRES_HOST = '**'
POSTGRES_PORT = '**'
POSTGRES_DB = '**'
SQLALCHEMY_DATABASE_URI = 'postgresql://{0}:{1}@{2}:{3}/{4}'.format(
POSTGRES_USER,
POSTGRES_PASSWORD,
POSTGRES_HOST,
POSTGRES_PORT,
POSTGRES_DB,
)
# Redis
REDIS_HOST = '**'
REDIS_PORT = '**'
# Celery
class CeleryConfig:
BROKER_URL = 'redis://{0}:{1}/0'.format(REDIS_HOST, REDIS_PORT)
CELERY_IMPORTS = ('superset.sql_lab',)
CELERY_RESULT_BACKEND = 'redis://{0}:{1}/1'.format(REDIS_HOST, REDIS_PORT)
CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}}
CELERY_TASK_PROTOCOL = 1
CELERY_CONFIG = CeleryConfig
FLASK_APP=superset
错误
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column dbs.server_cert does not exist
LINE 1: ...rm, dbs.impersonate_user AS dbs_impersonate_user, dbs.server...
^
[SQL: SELECT dbs.created_on AS dbs_created_on, dbs.changed_on AS dbs_changed_on, dbs.id AS dbs_id, dbs.verbose_name AS dbs_verbose_name, dbs.database_name AS dbs_database_name, dbs.sqlalchemy_uri AS dbs_sqlalchemy_uri, dbs.password AS dbs_password, dbs.cache_timeout AS dbs_cache_timeout, dbs.select_as_create_table_as AS dbs_select_as_create_table_as, dbs.expose_in_sqllab AS dbs_expose_in_sqllab, dbs.allow_run_async AS dbs_allow_run_async, dbs.allow_csv_upload AS dbs_allow_csv_upload, dbs.allow_ctas AS dbs_allow_ctas, dbs.allow_dml AS dbs_allow_dml, dbs.force_ctas_schema AS dbs_force_ctas_schema, dbs.allow_multi_schema_metadata_fetch AS dbs_allow_multi_schema_metadata_fetch, dbs.extra AS dbs_extra, dbs.encrypted_extra AS dbs_encrypted_extra, dbs.perm AS dbs_perm, dbs.impersonate_user AS dbs_impersonate_user, dbs.server_cert AS dbs_server_cert, dbs.created_by_fk AS dbs_created_by_fk, dbs.changed_by_fk AS dbs_changed_by_fk
FROM dbs ORDER BY dbs.changed_on DESC
LIMIT %(param_1)s]
应用此配置后,我对 pod 执行了一个 exec 并 运行 以下命令:
- 超集数据库升级
- 超集初始化
迁移似乎没有成功完成。尝试在超集容器内执行以下命令
superset db upgrade
为了执行迁移。
尽管如此,您不必在容器中手动执行命令来使其正常工作。超集 helm chart 接受一个 initFile
作为值来实现这一点,而无需手动执行到容器中。