Requirements

If you want to deploy AMS on Kubernetes, you’d better get a sense of the following things.

Amoro Official Docker Image

You can find the official docker image at Amoro Docker Hub.

The following are images that can be used in a production environment.

arctic163/amoro

This is an image built based on the Amoro binary distribution package for deploying AMS.

arctic163/optimizer-flink

This is an image built based on the official version of Flink for deploying the Flink optimizer.

Build AMS Docker Image

If you want to build images locally, you can find the build.sh script in the docker folder of the project and pass the following command:

  1. ./docker/build.sh amoro

or build the optimizer-flink image by:

  1. ./docker/build.sh optimizer-flink --flink-version <flink-version>

Get Helm Charts

You can obtain the latest official release chart by adding the official Helm repository.

  1. $ helm repo add amoro https://netease.github.io/amoro/charts
  2. $ helm search repo amoro
  3. NAME CHART VERSION APP VERSION DESCRIPTION
  4. amoro/amoro 0.1.0 0.6.0 A Helm chart for Amoro
  5. $ helm pull amoro/amoro
  6. $ tar zxvf amoro-*.tgz

Alternatively, you can find the latest charts directly from the Github source code.

  1. $ git clone https://github.com/NetEase/amoro.git
  2. $ cd amoro/charts
  3. $ helm dependency build ./amoro

Install

When you are ready, you can use the following helm command to start

  1. $ helm install <deployment-name> ./amoro

After successful installation, you can access WebUI through the following command.

  1. $ kubectl port-forward services/<deployment-name>-amoro-rest 1630:1630

Open browser to go web: http://loclhost:1630

Access logs

Then, use pod name to get logs:

  1. $ kubectl get pod
  2. $ kubectl logs {amoro-pod-name}

Uninstall

  1. $ helm uninstall <deployment-name>

Configuring Helm application.

Helm uses <chart>/values.yaml files as configuration files, and you can also copy this file for separate maintenance.

  1. $ cp amoro/values.yaml my-values.yaml
  2. $ vim my-values.yaml

And deploy Helm applications using independent configuration files.

  1. $ helm install <deployment-name> ./amoro -f my-values.yaml

Enable Ingress

Ingress is not enabled by default. In production environments, it is recommended to enable Ingress to access the AMS Dashboard from outside the cluster.

  1. ingress:
  2. enabled: true
  3. ingressClassName: "nginx"
  4. hostname: minikube.amoro.com

Configure the database.

AMS default is to use Derby database for storage. When the pod is destroyed, the data will also disappear. In production environments, we recommend using MySQL as the storage for system data.

  1. amoroConf:
  2. database:
  3. type: mysql
  4. driver: com.mysql.cj.jdbc.Driver
  5. url: <jdbc-uri>
  6. username: <mysql-user>
  7. password: <mysql-password>

Configure the Images

Helm charts deploy images by default using the latest tag. If you need to modify the image address, such as using a private repository or building your own image

  1. image:
  2. repository: <your repository>
  3. pullPolicy: IfNotPresent
  4. tag: <your tag>

By default, the Flink Optimizer Container is enabled. You can modify the container configuration by changing the optimizer.flink section.

  1. optimizer:
  2. flink:
  3. enabled: true
  4. ## container name, default is flink
  5. name: ~
  6. image:
  7. ## the image repository
  8. repository: arctic163/optimizer-flink
  9. ## the image tag, if not set, the default value is the same with amoro image tag.
  10. tag: ~
  11. ## the location of flink optimizer jar in image.
  12. jobUri: "local:///opt/flink/usrlib/optimizer-job.jar"
  13. properties: {
  14. "flink-conf.taskmanager.memory.managed.size": "32mb",
  15. "flink-conf.taskmanager.memory.netwrok.max": "32mb",
  16. "flink-conf.taskmanager.memory.netwrok.nin": "32mb"
  17. }

Configure the RBAC

By default, Helm Chart creates a service account, role, and role bind for Amaro deploy. You can also modify this configuration to use an existing account.

  1. # ServiceAccount of Amoro to schedule optimizer.
  2. serviceAccount:
  3. # Specifies whether a service account should be created or using an existed account
  4. create: true
  5. # Annotations to add to the service account
  6. annotations: { }
  7. # Specifies ServiceAccount name to be used if `create: false`
  8. name: ~
  9. # if `serviceAccount.create` == true. role and role-bind will be created
  10. rbac:
  11. # create a role/role-bind if automatically create service account
  12. create: true
  13. # create a cluster-role and cluster-role-bind if cluster := true
  14. cluster: false

Notes:

  • If serviceAccount.create is false, you must provide a serviceAccount.name and create the serviceAccount beforehand.
  • If serviceAccount.rbac.create is false, the role and role-bind will not be created automatically.
  • You can set serviceAccount.rbac.cluster to true, which will create a cluster-role and cluster-role-bind instead of a role and role-bind.

By default, the serviceAccount will be used to create the flink-optimizer. Therefore, if you need to schedule the flink-optimizer across namespaces, please create a cluster-role or use your own created serviceAccount.