Skip to main content

在 Google GKE 上安装 Quickwit

本指南将帮助您使用正确的 GCS 权限设置 Quickwit 集群。

设置

在使用 Helm 安装 Quickwit 之前,让我们为我们的试验环境创建一个命名空间。

export NS=quickwit-tutorial
kubectl create ns ${NS}

Quickwit 将其索引存储在对象存储上。我们将使用自 0.7 版本起原生支持的 GCS(对于 < 0.7 的版本,您应该使用 S3 互操作密钥)。

以下步骤将创建一个 GCP 和一个 GKE 服务账户并将它们绑定在一起。 我们将创建这些账户,设置正确的权限并将其绑定。

export PROJECT_ID={your-project-id}
export GCP_SERVICE_ACCOUNT=quickwit-tutorial
export GKE_SERVICE_ACCOUNT=quickwit-sa
export BUCKET=your-bucket

kubectl create serviceaccount ${GKE_SERVICE_ACCOUNT} -n ${NS}

gcloud iam service-accounts create ${GCP_SERVICE_ACCOUNT} --project=${PROJECT_ID}

gcloud storage buckets add-iam-policy-binding gs://${BUCKET} \
--member "serviceAccount:${GCP_SERVICE_ACCOUNT}@${PROJECT_ID}.iam.gserviceaccount.com" \
--role "roles/storage.objectAdmin"

# Notice that the member is related to a namespace.
gcloud iam service-accounts add-iam-policy-binding ${GCP_SERVICE_ACCOUNT}@${PROJECT_ID}.iam.gserviceaccount.com \
--role roles/iam.workloadIdentityUser \
--member "serviceAccount:${PROJECT_ID}.svc.id.goog[${NS}/${GKE_SERVICE_ACCOUNT}]"

# Now we can annotate our service account!
kubectl annotate serviceaccount ${GKE_SERVICE_ACCOUNT} \
iam.gke.io/gcp-service-account=${GCP_SERVICE_ACCOUNT}@${PROJECT_ID}.iam.gserviceaccount.com \
-n ${NS}

使用 Helm 安装 Quickwit

现在我们可以准备在 GKE 上安装 Quickwit 了。如果您想了解更多关于 Helm 的信息,请查阅我们的 详细指南,了解如何在 Kubernetes 上安装 Quickwit。

helm repo add quickwit https://helm.quickwit.io
helm repo update quickwit

Let's set Quickwit values.yaml:

# We use the edge version here as we recently fixed
# a bug which prevents the metastore from running on GCS.
image:
repository: quickwit/quickwit
pullPolicy: Always
tag: edge

serviceAccount:
create: false
name: quickwit-sa

config:
default_index_root_uri: gs://{BUCKET}/qw-indexes
metastore_uri: gs://{BUCKET}/qw-indexes

我们现在可以进行部署:

helm install <deployment name> quickwit/quickwit -f values.yaml

检查 Quickwit 是否正在运行

集群启动可能需要几秒钟的时间。在启动过程中,各个 Pod 可能会重启几次。

要访问 UI,您可以运行以下命令,然后在浏览器中打开 http://localhost:7280

kubectl port-forward svc/release-name-quickwit-searcher 7280:7280

卸载部署

运行以下 Helm 命令来卸载部署:

helm uninstall <deployment name>

别忘了清理您的存储桶,Quickwit 应该已经在 gs://{BUCKET}/qw-indexes 中存储了 3 个文件。