Elasticsearch专题精讲——Installing Elasticsearch ——Install ECK using the Helm chart

Install ECK using the Helm chart

Starting from ECK 1.3.0, a Helm chart is available to install ECK. It is available from the Elastic Helm repository and can be added to your Helm repository list by running the following command:

从 ECK 1.3.0 开始,可以使用 Helm 来安装 ECK。它可以从 Elastic Helm 仓库获得,并且可以通过运行以下命令添加到 Helm 仓库列表中:

helm repo add elastic https://helm.elastic.co
helm repo update

The minimum supported version of Helm is 3.2.0.

Helm 的最小支持版本是3.2.0。

一、Cluster-wide(global)installation

This is the default mode of installation and is equivalent to installing ECK using the stand-alone YAML manifests(https://www.cnblogs.com/zuoyang/p/17366871.html).

这是默认安装模式,相当于使用独立的 YAML 清单( https://www.cnblogs.com/zuoyang/p/17366871.html )安装 ECK。

helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace

二、Restricted installation

This mode avoids installing any cluster-scoped resources and restricts the operator to manage only a set of pre-defined namespaces.

此模式避免安装任何集群范围的资源,并限制 operator 只能管理一组预定义的命名空间。

Since CRDs are global resources, they still need to be installed by an administrator. This can be achieved by:

由于 CRD 是 global 资源,因此仍需由管理员安装:

helm install elastic-operator-crds elastic/eck-operator-crds

The operator can be installed by any user who has full access to the set of namespaces they wish to manage. The following example installs the operator to elastic-system namespace and configures it to manage only namespace-a and namespace-b :

该 operator 可以由任何拥有完整访问要管理的名称空间集的用户进行安装。以下示例将该 operator 安装到名为 elastic-system 的名称空间中,并将其配置为仅管理 namespace-a 和 namespace-b 两个名称空间:

helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace \
  --set=installCRDs=false \
  --set=managedNamespaces='{namespace-a, namespace-b}' \
  --set=createClusterScopedResources=false \
  --set=webhook.enabled=false \
  --set=config.validateStorageClass=false

The eck-operator chart contains several pre-defined profiles to help you install the operator in different configurations. These profiles can be found in the root of the chart directory, prefixed with profile-. For example, the restricted configuration illustrated in the previous code extract is defined in the profile-restricted.yaml file, and can be used as follows:

eck-operator chart 包含多个预定义配置文件来帮助您在不同的配置下安装 operator 。这些配置文件可以在 chart 目录的根目录中找到,以 profile- 为前缀。例如,前面代码片段示例中的限制配置在 profile-restricted.yaml 文件中定义,并可以按如下方式使用:

helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace \
  --values="${CHART_DIR}/profile-restricted.yaml" \
  --set=managedNamespaces='{namespace-a, namespace-b}'

You can find the profile files in the Helm cache directory or from the ECK source repository(https://github.com/elastic/cloud-on-k8s/tree/2.7/deploy/eck-operator).

您可以在 Helm cache 目录或 ECK 源代码存储库( https://github.com/elastic/cloud-on-k8s/tree/2.7/deploy/ECK-operator )中找到配置文件。

三、View available configuration options

You can view all configurable values by running the following:

helm show values elastic/eck-operator
  

You can migrate an existing operator installation to Helm by adding the meta.helm.sh/release-name, meta.helm.sh/release-namespace annotations and the app.kubernetes.io/managed-by label to all the resources you want to be adopted by Helm. You must do this for the Elastic Custom Resource Definitions (CRD) because deleting them would trigger the deletion of all deployed Elastic applications as well. All other resources are optional and can be deleted.

您可以通过添加 meta.helm.sh/release-name、meta.helm.sh/release-namespace 注释和 app.kubernetes.io/managed-by 标签将现 operator 安装迁移到 Helm。您必须对 Elastic 自定义资源定义(CRD)执行此操作,因为删除它们会触发所有已部署的 Elastic 应用程序的删除。所有其他资源都是可选的,可以删除。

A shell script is available in the ECK source repositoryto demonstrate how to migrate from version 1.7.1 to Helm. You can modify it to suit your own environment.(https://github.com/elastic/cloud-on-k8s/blob/2.7/deploy/helm-migrate.sh)

ECK 源代码库中提供了一个 shell 脚本来演示如何从版本 1.7.1 迁移到 Helm。您可以修改它以适应您自己的环境。

For example, an ECK 1.2.1 installation deployed using the quickstart guide can be migrated to Helm as follows:

例如,使用 Quick start 指南部署的 ECK 1.2.1安装可以迁移到 Helm,如下所示:

3.1、Annotate and label all the ECK CRDs with the appropriate Helm annotations and labels. CRDs need to be preserved to retain any existing Elastic applications deployed using the operator.

3.1、使用适当的 Helm 注释和标签对所有 ECK CRD 进行注释和标签。需要保留 CRD,以保留使用 operator 部署的任何现有 Elastic 应用程序。

for CRD in $(kubectl get crds --no-headers -o custom-columns=NAME:.metadata.name | grep k8s.elastic.co); do
    kubectl annotate crd "$CRD" meta.helm.sh/release-name="$RELEASE_NAME"
    kubectl annotate crd "$CRD" meta.helm.sh/release-namespace="$RELEASE_NAMESPACE"
    kubectl label crd "$CRD" app.kubernetes.io/managed-by=Helm
done 
        

3.2、Uninstall the current ECK operator. You can do this by taking the operator.yaml file you used to install the operator and runningkubectl delete -f operator.yaml. Alternatively, you could delete each resource individually.

卸载当前 ECK operator。为此, 可以使用用于安装 operator.yaml 文件并运行 kubectl delete -f operator.yaml

kubectl delete -n elastic-system \
    serviceaccount/elastic-operator \
    secret/elastic-webhook-server-cert \
    clusterrole.rbac.authorization.k8s.io/elastic-operator \
    clusterrole.rbac.authorization.k8s.io/elastic-operator-view \
    clusterrole.rbac.authorization.k8s.io/elastic-operator-edit \
    clusterrolebinding.rbac.authorization.k8s.io/elastic-operator \
    service/elastic-webhook-server \
    configmap/elastic-operator \ 
    statefulset.apps/elastic-operator \
    validatingwebhookconfiguration.admissionregistration.k8s.io/elastic-webhook.k8s.elastic.co
    

3.3、If you have previously customized the operator configuration in this ConfigMap, you will have to repeat the configuration once the operator has been reinstalled in the next step.

3.3、如果您以前已经在这个 ConfigMap 中定制了 operator 配置,那么在下一步中重新安装 operator 之后,您必须重复这个配置。

3.4、Install ECK using the Helm chart.

3.4、使用 Helm chart 安装 ECK operator,如使用 Helm chart 安装 ECK 中所述。

posted @ 2023-05-01 20:21  左扬  阅读(191)  评论(0编辑  收藏  举报
levels of contents