Helm 图表部署

Tableau Server Helm 图表 - 部署

重要信息:本文档假设您了解 Helm 和 Helm 图表,并不试图提供详细的说明性示例。它是为熟悉 Tableau Server 以及 Helm 和 Helm 图表的客户设计的。

本主题将引导您完成使用 Helm 图表在 Kubernetes 上部署 Tableau Server 的高级步骤。

先决条件

在开始之前,请确保您已满足先决条件。有关详细信息,请参见Tableau Server Helm 图表 - 先决条件。

Helm 图表下载

Helm 图表将作为“容器中的 Tableau Server”设置工具 (tableau-server-container-setup-tool-<version>.tar.gz) 的一部分提供,并可从 Tableau Server 下载页面下载。

提取后,所需的 Helm 图表文件位于 helm/tableau 目录中。

快速概览:使用 Helm 图表部署 Tableau Server

重要信息:这是使用 Helm 图表部署 Tableau Server 的基本概略描述。这并不是一个完整的过程。它假定您了解 Helm 和 Helm 图表。

在开始之前,请确保您已满足使用 Helm 图表部署 Tableau Server 的先决条件。有关详细信息,请参见Tableau Server Helm 图表 - 先决条件。

将许可证密钥添加到 values.yaml

编辑 values.yaml 并设置您的许可证密钥。

部署单节点 Tableau Server

通过在提示符处执行以下命令来部署 Tableau Server 的单节点实例(用您的发布命名空间替换 <namespace>,例如 tableau 或 default):

helm install tableau-server ./helm/tableau-server \
-n <namespace> \
--create-namespace \ -f ./helm/tableau-server/values-single.yaml

部署多节点 Tableau Server

通过在提示符处执行以下命令并使用与上面相同的命名空间约定来部署 Server 的多节点实例:

helm install tableau-server ./helm/tableau-server \
-n <namespace> \
--create-namespace \ -f ./helm/tableau-server/values-multinode.yaml

EKS 多节点 Runbook(命名空间 + 静态引导程序 PV)

本部分介绍 EKS 的操作顺序:专用命名空间、EFS CSI 加载项、节点角色上的 IAM、静态引导程序 PV 和 Helm。

  1. 创建专用命名空间。

    这必须在引导程序 PV 上匹配 claimFef.namespace。此示例使用 tableau。

    kubectl create namespace tableau-server
    kubectl get namespace tableau
  2. 确认 EFS CSI 加载项存在。

    如果缺少加载项,请创建它并等待状态变为 ACTIVE:

    kubectl get csidriver efs.csi.aws.com
    aws eks describe-addon \
      --cluster-name <cluster-name> \  
      --addon-name aws-efs-csi-driver \
      --region <region> \
      --query 'addon.status'
  3. 确认 Storageclass:

    efs-bootstrap Storageclass - 如果尚未存在,则应用。有关详细信息,请参见Amazon Elastic Kubernetes Service (EKS) 先决条件。

    kubectl get csidriver efs.csi.aws.com
    aws eks describe-addon \
      --cluster-name <cluster-name> \  
      --addon-name aws-efs-csi-driver \
      --region <region> \
      --query 'addon.status'
  4. 确认静态引导程序 PV。

    claimRef 必须引用 Helm 图表创建的相同命名空间和 PVC 名称 (tableau-server-bootstrap)。将 fs-... 替换为您的 EFS 文件系统 ID:

    cat > /tmp/tableau-bootstrap-pv.yaml <<'EOF'
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: tableau-bootstrap-pv
    spec:
      capacity:
        storage: 1Gi
      volumeMode: Filesystem
      accessModes:
        - ReadWriteMany
    persistentVolumeReclaimPolicy: Retain
    storageClassName: efs-bootstrap
    claimRef:
      namespace: tableau
      name: tableau-server-bootstrap
    csi:
      driver: efs.csi.aws.com
      volumeHandle: <fs-xxxxxxxxxxxxxxxxx>
    EOF
    kubectl apply -f /tmp/tableau-bootstrap-pv.yaml
    kubectl get pv tableau-bootstrap-pv
  5. 节点实例角色上的 IAM。

    附加 EFS 客户端和 EC2 只读策略。请参见从节点组解析 <your-node-instance-role> 的 Amazon Elastic Kubernetes Service (EKS) 先决条件。

    efs-bootstrap Storageclass - 如果尚未存在,则应用。有关详细信息,请参见Amazon Elastic Kubernetes Service (EKS) 先决条件。

    kubectl get csidriver efs.csi.aws.com
    aws eks describe-addon \
      --cluster-name <cluster-name> \  
      --addon-name aws-efs-csi-driver \
      --region <region> \
      --query 'addon.status'
  6. 值

    在 values-multinode.yaml(或叠加)中,设置手动静态 PV 模式

    persistence:
      bootstrap:
    createPV: false
    volumeName: tableau-bootstrap-pv
    storageClass: efs-bootstrap
  7. 确保按要求设置了 image.repository、image.tag 以及密文/许可证。

  8. 安装 Helm 图表

    将图表安装到与 PV claimRef 相同的命名空间中:

    helm install tableau-server ./helm/tableau-server \
      -n tableau \
    -f ./helm/tableau-server/values-multinode.yaml
  9. 验证存储和 pod:

    kubectl get pv,pvc -n tableau
    kubectl get pods -n tableau -w
  10. 数据 PVC 状态

    在附加 EBS 卷之前,数据 PVC 可能会短暂显示 Pending。所有 PVC 都应过渡到 Bound,然后是 Running,最后是 READY 1/1。

  11. 拓扑(可选)

    如果禁用了安装后挂钩,则可能需要设置节点 clustercontroller 并应用挂起的更改(请参见本文档后面的“安装后拓扑自动化(挂钩)”)。当您有多个 Tableau 节点时,tsm pending-changes apply 命令可能会生成有关索引和搜索服务器分发或协调服务整体的警告。按照索引和搜索服务器以及Tableau Server 协调服务中所述解决这些警告。

自定义安装

  1. 自定义值

    cp ./helm/tableau-server/values.yaml 
    ./helm/tableau-server/my-values.yaml
    # Edit ./helm/tableau-server/my-values.yaml with your configuration
  2. 使用自定义值安装

    helm install tableau-server ./helm/tableau-server -f ./helm/tableau-server/my-values.yaml

配置

部署模式

单节点部署

单节点部署将 Tableau Server 作为整体容器运行。

使用 values-single.yaml 或设置:

deploymentMode: "single"
primary:
replicaCount: 1
worker:
replicaCount: 0

多节点部署

多节点部署运行一个主节点以及一个或多个工作线程。使用 worker.replicaCount 设置工作线程计数 — 使用 1、2 或群集容量和 Tableau 拓扑允许的任何更高值。图表针对 replicaCount: N 创建 tableau-server-worker-0 … tableau-server-worker-(N-1)。

使用 values-multinode.yaml(默认示例使用两个工作线程)或显式设置:

deploymentMode: "multinode"
primary:
replicaCount: 1
worker:
replicaCount: 3 # example: three workers

拓扑对齐:values-multinode.yaml 随示例 config.configJson 拓扑(节点 ID,例如 node1、node2、node3)一起提供。如果您更改 worker.replicaCount 或重新排列服务,请更新该拓扑(以及任何相关的 Tableau 进程分配),以使 TSM 节点的数量和角色与您的部署匹配 — 请参见 Tableau Server 群集和进程布局帮助。

关键配置选项

映像配置

image:
repository: tableau_server_image
tag: "latest"
pullPolicy: IfNotPresent
pullSecrets: []

许可证和密文

secrets:
  licenseKey: "YOUR-LICENSE-KEY"
tsmRemotePassword: "password"
tableauUsername: "admin"
tableauPassword: "password"

或者,您可以使用环境变量设置这些值:

env:
LICENSE_KEY: "YOUR-LICENSE-KEY"
TSM_REMOTE_PASSWORD: "password"
TABLEAU_USERNAME: "admin"
TABLEAU_PASSWORD: "password"

我们建议使用单独的文件(例如 secrets.yaml)并使用 -f 开关传递该文件。

secrets.yaml:

secrets:
licenseKey: "YOUR-LICENSE-KEY"
tsmRemotePassword: "YOUR-TSM-PASSWORD"
tableauUsername: "YOUR-ADMIN-USER"
tableauPassword: "YOUR-ADMIN-PASSWORD"

具有 secrets.yaml 的安装/升级示例:

helm upgrade --install tableau-server ./helm/tableau-server \
-n default \
-f ./helm/tableau-server/values-multinode.yaml \
-f ./helm/tableau-server/secrets.yaml

注意:目前不支持引用预先存在的 Kubernetes 密文(例如 secrets.existingSecret)。唯一支持的方法是将图表值与单独的密文值文件配合使用。

外部 PostgreSQL 存储库

默认情况下,Helm 图表不使用专用值键启用外部存储库。

我们建议您采取以下步骤来启用外部存储库:

  1. 部署图表并确认主节点运行正常。

  2. 从主 pod 中运行 Tableau tsm external repository 命令。

  3. 应用待处理的更改。

示例工作流(命令发现和应用):

# Discover command syntax for your Tableau version
kubectl exec -n default tableau-server-primary-0 -- sh -lc 'tsm topology external-services repository enable --help'
# After enabling external repository with Tableau-supported args/options:
kubectl exec -n default tableau-server-primary-0 -- sh -lc 'tsm pending-changes apply -iw --ignore-prompt'
kubectl exec -n default tableau-server-primary-0 -- sh -lc 'tsm status -v'

注意:

  • 外部存储库配置特定于 Tableau 版本(SSL 模式、故障转移选项、凭据字段)。有关详细信息,请参见Tableau Server 外部存储库和tsm topology。

  • 对于客户部署,请将数据库凭据存储在 Kubernetes 密文中,并避免在 shell 历史记录中使用纯文本。

持久性存储

persistence:
enabled: true
storageClass: "standard"
accessMode: ReadWriteOnce
size: 100Gi

# Bootstrap volume (required for multi-node)
bootstrap:
enabled: true
storageClass: "standard"
accessMode: ReadWriteMany
size: 1Gi
createPV: false

对于使用静态 EFS CSI 的群集(例如,使用 mounttargetip),Helm 可以同时管理引导程序 PV 和 PVC:

persistence:
bootstrap:
enabled: true
storageClass: "efs-bootstrap"
accessMode: ReadWriteMany
size: 1Gi
createPV: true
permissionsFix:
enabled: true
pv:
name: "tableau-bootstrap-pv"
csi:
driver: efs.csi.aws.com
volumeHandle: "fs-xxxxxxxx"
volumeAttributes:
mounttargetip: "10.x.x.x"

permissionsFix.enabled 添加一个进行 chown/chmods /docker/config/bootstrap 的初始化容器,以便 Tableau 进程 (UID/GID 999:998) 可以在默认为 root:root 的共享 EFS 挂载上写入 bootstrap.json。

当 createPV: true 时,图表会依据值(例如 tableau-bootstrap-pv)创建引导程序 PV,并将 tableau-server-bootstrap PVC 绑定到该 PV。

如果您手动管理引导程序 PV,请先创建 tableau-bootstrap-pv,然后使用 createPV: false 和 volumeName: tableau-bootstrap-pv: 安装 Helm

apiVersion: v1
kind: PersistentVolume
metadata:
  name: tableau-bootstrap-pv
spec:
  capacity:
    storage: 1Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: efs-bootstrap
  csi:
    driver: efs.csi.aws.com
    volumeHandle: fs-xxxxxxxx
    volumeAttributes:
      mounttargetip: 10.x.x.x
kubectl apply -f tableau-bootstrap-pv.yaml
kubectl get pv tableau-bootstrap-pv

资源限制

primary:
  resources:
    limits:
      cpu: "4"
      memory: "8Gi"
    requests:
      cpu: "2"
      memory: "4Gi"

worker:
  resources:
    limits:
      cpu: "4"
      memory: "8Gi"
    requests:
      cpu: "2"
      memory: "4Gi"

服务配置

service:
  primary:
    type: ClusterIP  # or NodePort, LoadBalancer
    ports:
      http: 80
      https: 8080
      tsm: 8850

入口

ingress:
  enabled: true
  className: "nginx"
  hosts:
    - host: tableau.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: tableau-tls
      hosts:
        - tableau.example.com

入口设置 Runbook(示例:NGINX 入口控制器)

  1. 在群集中安装入口控制器(启用图表入口之前需要)。

  2. 在您的 values 文件中设置入口值:

    ingress:
    enabled: true
    className: "nginx"
    annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "64m"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
    hosts:
    - host: tableau.example.com
    paths:
    - path: /
    pathType: Prefix
    tls:
    - secretName: tableau-tls
    hosts:
    - tableau.example.com
  3. 创建将 tableau.example.com 指向您的入口/负载均衡器端点的 DNS 记录。

  4. 在 release 命名空间中创建 TLS 密文(或使用 cert-manager)。

  5. 部署/升级图表并验证入口:

    helm upgrade --install tableau-server ./helm/tableau-server -n default -f ./helm/tableau-server/values.yaml
    kubectl get ingress -n default
    kubectl describe ingress tableau-server

有关详细信息,请参见:

运行状况检查

图表支持启动、活动和就绪情况探测器。启动探测器允许在活动/就绪情况探测器运行之前进行长时间的首次初始化(例如 failureThreshold:200 × periodSeconds):

healthChecks:
  startup:
    enabled: true
    initialDelaySeconds: 300
    periodSeconds: 15
    timeoutSeconds: 30
    failureThreshold: 200
  liveness:
    enabled: true
    initialDelaySeconds: 300
    periodSeconds: 30
    timeoutSeconds: 10
    failureThreshold: 3
  readiness:
    enabled: true
    initialDelaySeconds: 300
    periodSeconds: 10
    timeoutSeconds: 5
    failureThreshold: 3

对于多节点工作线程 pod,图表的默认值 worker.healthChecks.enabled: false 是为了避免在工作线程运行有限的进程集(例如,仅限管理代理 + 群集控制器)时出现错误探测故障。

用法

访问 Tableau Server

安装后,根据您的服务配置访问 Tableau Server:

  • ClusterIP:使用端口转发或入口

  • NodePort:通过 <node-ip>:<node-port> 进行访问

  • LoadBalancer:通过提供的外部 IP 进行访问

使用 TSM 命令

# Get pod name
POD_NAME=$(kubectl get pods -l app.kubernetes.io/component=primary -o jsonpath='{.items[0].metadata.name}')

# Run tabcmd
kubectl exec -it $POD_NAME -- tsm status
kubectl exec -it $POD_NAME -- tsm configuration get

使用 tabcmd

# Get pod name
POD_NAME=$(kubectl get pods -l app.kubernetes.io/component=primary -o jsonpath='{.items[0].metadata.name}')

# Run tabcmd
kubectl exec -it $POD_NAME -- tabcmd login -u admin -p password
kubectl exec -it $POD_NAME -- tabcmd sites

查看 Tableau Server 日志

# Primary node logs
kubectl logs -l app.kubernetes.io/component=primary -f

# Worker node logs (multi-node)
kubectl logs -l app.kubernetes.io/component=worker -f

# All logs
kubectl logs -l app.kubernetes.io/instance=tableau-server -f

Shell 访问

# Get pod name
POD_NAME=$(kubectl get pods -l app.kubernetes.io/component=primary -o jsonpath='{.items[0].metadata.name}')

# Open shell
kubectl exec -it $POD_NAME -- /bin/bash

升级

升级 Tableau Server Helm 图表

helm upgrade tableau-server ./helm/tableau-server -f ./helm/tableau-server/values.yaml

使用新值升级

helm upgrade tableau-server ./helm/tableau-server -f ./helm/tableau-server/new-values.yaml

安装后拓扑自动化(挂钩)

对于多节点安装,此图表可以运行安装后/升级后的挂钩作业,该作业:

  • 等待工作线程节点在 TSM 中注册

  • 设置工作线程 clustercontroller 进程分配

  • 在更改处于挂起状态时运行 tsm pending-changes apply -iw --ignore-prompt

配置:

hooks:
  autoApplyWorkerTopology:
    enabled: true
    kubectlImage: "bitnami/kubectl:latest"
    timeoutSeconds: 3600

默认值:

  • 在 values.yaml 中已禁用

  • 在 values-multinode.yaml 中,检查 hooks.autoApplyWorkerTopology.enabled(可能是 true 或 false ,具体取决于版本;为无需人工操作的工作线程 clustercontroller 设置启用)

验证挂钩执行:

kubectl get jobs -n default
kubectl get pods -n default -l job-name=tableau-server-hook-topology
kubectl logs -n default job/tableau-server-hook-topology

如果挂钩被禁用或失败则手动回退 — 为每个工作线程 TSM 节点运行 tsm topology set-process(当您有 N 个工作线程时,通常为节点 2 到节点 (1+N);使用 tsm topology list-nodes -v 确认 ID):

kubectl exec -n default tableau-server-primary-0 -- sh -lc '
tsm topology set-process -n node2 -pr clustercontroller -c 1
tsm topology set-process -n node3 -pr clustercontroller -c 1
# Add one line per additional worker node, e.g. for four workers:
# tsm topology set-process -n node4 -pr clustercontroller -c 1
# tsm topology set-process -n node5 -pr clustercontroller -c 1
tsm pending-changes apply -iw --ignore-prompt
tsm topology list-nodes -v

tsm status -v

注意:为 tsm pending-changes apply 使用 -iw。-ig 选项在此环境中无效。

卸载

helm uninstall tableau-server

警告:这将删除所有资源,包括持久性卷。确保在卸载之前备份您的数据。

验证步骤

在发布之前或更改图表时,请运行:

  1. Lint:

    helm lint helm/tableau-server -f helm/tableau-server/values-single.yaml
    helm lint helm/tableau-server -f helm/tableau-server/values-multinode.yaml
  2. 模板(试运行):

    helm template tableau-server helm/tableau-server -f helm/tableau-server/values-single.yaml
    helm template tableau-server helm/tableau-server -f helm/tableau-server/values-multinode.yaml
  3. 安装测试(可选):

    1. 在测试命名空间中,使用 values-single 或 values-multinode 运行 helm install。

    2. 运行 kubectl rollout status(对于 StatefulSet,请等待 pod 就绪)和基本冒烟检查(例如 tsm status 或 HTTP 到服务)。

有关详细的疑难解答,请参见Tableau Server Helm 图表 - 疑难解答。

其他资源