presto - moving worker from docker to kubernetes
It looks like you've combined parts of a Deployment and a Service; they're two different objects. You can break this up:
---apiVersion: apps/v1 kind: Deploymentmetadata: name: presto-workerspec: selector: matchLabels: app: presto-worker replicas: 2 template: metadata: labels: app: presto-worker spec: containers: - name: presto-image image: docker.io/mystuff/presto-image:latest ports: - containerPort: 8080---apiVersion: v1 kind: Servicemetadata: name: presto-workerspec: type: NodePort selector: matchLabels: app: presto-worker ports: - name: http port: 8080
The Service selector points at specific pods; it needs to match the deployment spec's pod template labels. The Deployment selector names the pods that the Deployment manages. In both cases they point at pods but they're for different purposes.
Here's a working Helm chart (i.e., template package of k8s resources) for presto: https://github.com/helm/charts/tree/master/stable/presto.
Here's basic design of a presto cluster in k8s from above Chart:
- single coordinator. discoverable (by workers) over http://:8080 - this is where you need a k8s service exposed for coordinator so that all workers can perform discovery against this coordinator (actually it's the discover service exposed by coordinator).
- a number of stateless workers via a k8s deployment. You do not need to expose any ports nor k8s service since no external process will reach to worker process at all.
- uses k8s configMap to inject customized presto configuration. the most important config for a presto cluster is
discovery-server.enabled=true
in<presto-home>/etc/config.properties
of your presto coordinator or your coordinator is not discoverable at all. (a.k.a., can not have external worker process over network).
According to this question, you need to make sure presto coordinator is accessible by worker process via DNS name like http://my-presto-coordinator:8080
.
This is what I got from chart stable/presto
by running helm template .
(render all template in stdout). you will need to replace RELEASE-NAME
with lowercase strings to use it:
---# Source: charts/presto/templates/deployment-worker.yamlapiVersion: apps/v1beta2kind: Deploymentmetadata: name: RELEASE-NAME-presto-worker labels: app: presto chart: presto-0.1 release: RELEASE-NAME heritage: Tiller component: workerspec: replicas: 2 selector: matchLabels: app: presto release: RELEASE-NAME component: worker template: metadata: labels: app: presto release: RELEASE-NAME component: worker spec: volumes: - name: config-volume configMap: name: RELEASE-NAME-presto-worker containers: - name: presto-worker image: "bivas/presto:0.196" imagePullPolicy: IfNotPresent command: ["/bin/bash"] args: - /etc/presto/docker-presto.sh volumeMounts: - mountPath: /etc/presto name: config-volume livenessProbe: exec: command: - /bin/bash - /etc/presto/health_check.sh initialDelaySeconds: 10 periodSeconds: 25 readinessProbe: exec: command: - /bin/bash - /etc/presto/health_check.sh initialDelaySeconds: 5 periodSeconds: 10 resources: {}