You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "georgew5656 (via GitHub)" <gi...@apache.org> on 2023/07/27 17:57:13 UTC
[PR] Add read me (druid)
georgew5656 opened a new pull request, #14674:
URL: https://github.com/apache/druid/pull/14674
### Description
Create a README for the kubernetes-overlord-extensions contrib extension that shows how to configure and use Kubernetes task scheduling.
#### Release note
- Include readme with description and configurations for the kubernetes task runner.
##### Key changed/added classes in this PR
README
<!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
This PR has:
- [X ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read me (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1277069702
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=overlordSingleContainer (defaults to this if not specified)
+ druid.indexer.runner.k8s.adapter.type=overlordMultiContainer (same as overlordSingleContainer except sidecars are respected)
+ ```
+ Additional overlord runtime properties
+ ```
+ druid.indexer.runner.javaOptsArray=[] (JVM args for the peon running in the Job, If -Xmx is specified, the adapter will attempt to scale the Kubernetes requests of the pod to correspond with it)
+ druid.indexer.runner.labels={} (Additional labels to add to the Job)
+ druid.indexer.runner.annotations={} (Additional annotations to add to the Job)
+ druid.indexer.runner.peonMonitors={} (Override the list of Druid monitors for the peon, otherwise the overlord's list will be used)
+ ```
+
+ #### Option 2. Bring your own pod template to use as the base job pod template
+ This adapter expects a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system.
+ This pod template is used as the base of the job template (additional info like the task id is injected on top of it).
+ You can override things like labels, environment variables, resources, annotation, or even the base image with this template.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=customTemplateAdapter
+ druid.indexer.runner.k8s.podTemplate.base=/opt/druid/conf/druid/cluster/pod-template.yaml` (location of pod template on overlord)
+ ```
+
+ The following PodTemplate is an example that uses the regular druid docker image.
+ ```
+ apiVersion: "v1"
+ kind: "PodTemplate"
+ template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
Review Comment:
`/peon.sh`
Where does this file come from?
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=overlordSingleContainer (defaults to this if not specified)
+ druid.indexer.runner.k8s.adapter.type=overlordMultiContainer (same as overlordSingleContainer except sidecars are respected)
+ ```
+ Additional overlord runtime properties
+ ```
+ druid.indexer.runner.javaOptsArray=[] (JVM args for the peon running in the Job, If -Xmx is specified, the adapter will attempt to scale the Kubernetes requests of the pod to correspond with it)
+ druid.indexer.runner.labels={} (Additional labels to add to the Job)
+ druid.indexer.runner.annotations={} (Additional annotations to add to the Job)
+ druid.indexer.runner.peonMonitors={} (Override the list of Druid monitors for the peon, otherwise the overlord's list will be used)
+ ```
+
+ #### Option 2. Bring your own pod template to use as the base job pod template
+ This adapter expects a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system.
+ This pod template is used as the base of the job template (additional info like the task id is injected on top of it).
+ You can override things like labels, environment variables, resources, annotation, or even the base image with this template.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=customTemplateAdapter
+ druid.indexer.runner.k8s.podTemplate.base=/opt/druid/conf/druid/cluster/pod-template.yaml` (location of pod template on overlord)
+ ```
+
+ The following PodTemplate is an example that uses the regular druid docker image.
+ ```
+ apiVersion: "v1"
+ kind: "PodTemplate"
+ template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - configMap:
+ defaultMode: 420
+ name: druid-tiny-cluster-peons-config
+ name: nodetype-config-volume
+ - emptyDir: {}
+ name: data-volume
+ - emptyDir: {}
+ name: deepstorage-volume
+ ```
+
+ Runtime properties that need to be passed to the Job's peon process
+
+ ```
+ druid.port=8100 (what port the peon should run on)
+ druid.peon.mode=remote
+ druid.service=druid/peon (for metrics reporting)
+ druid.indexer.task.baseTaskDir=/druid/data (this should match the argument to the ./peon.sh run command in the PodTemplate)
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
Review Comment:
I think you can get rid of this block and move the comments from here down to lines 214 -220.
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=overlordSingleContainer (defaults to this if not specified)
+ druid.indexer.runner.k8s.adapter.type=overlordMultiContainer (same as overlordSingleContainer except sidecars are respected)
+ ```
+ Additional overlord runtime properties
+ ```
+ druid.indexer.runner.javaOptsArray=[] (JVM args for the peon running in the Job, If -Xmx is specified, the adapter will attempt to scale the Kubernetes requests of the pod to correspond with it)
+ druid.indexer.runner.labels={} (Additional labels to add to the Job)
+ druid.indexer.runner.annotations={} (Additional annotations to add to the Job)
+ druid.indexer.runner.peonMonitors={} (Override the list of Druid monitors for the peon, otherwise the overlord's list will be used)
+ ```
+
+ #### Option 2. Bring your own pod template to use as the base job pod template
+ This adapter expects a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system.
+ This pod template is used as the base of the job template (additional info like the task id is injected on top of it).
+ You can override things like labels, environment variables, resources, annotation, or even the base image with this template.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=customTemplateAdapter
+ druid.indexer.runner.k8s.podTemplate.base=/opt/druid/conf/druid/cluster/pod-template.yaml` (location of pod template on overlord)
+ ```
+
+ The following PodTemplate is an example that uses the regular druid docker image.
+ ```
+ apiVersion: "v1"
+ kind: "PodTemplate"
+ template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - configMap:
+ defaultMode: 420
+ name: druid-tiny-cluster-peons-config
+ name: nodetype-config-volume
+ - emptyDir: {}
+ name: data-volume
+ - emptyDir: {}
+ name: deepstorage-volume
+ ```
+
+ Runtime properties that need to be passed to the Job's peon process
+
+ ```
+ druid.port=8100 (what port the peon should run on)
+ druid.peon.mode=remote
+ druid.service=druid/peon (for metrics reporting)
+ druid.indexer.task.baseTaskDir=/druid/data (this should match the argument to the ./peon.sh run command in the PodTemplate)
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ ```
+
+ Any runtime property or jvm config used by the peon process can also be passed here
+
+ E.G. below is a example of a ConfigMap that can be used to generate the nodetype-config-volume mount in the above template.
+ ```
+ kind: ConfigMap
+ metadata:
+ name: druid-tiny-cluster-peons-config
+ namespace: default
+ apiVersion: v1
+ data:
+ jvm.config: |-
+ -server
+ -XX:MaxDirectMemorySize=1000M
+ -Duser.timezone=UTC
+ -Dfile.encoding=UTF-8
+ -Dlog4j.debug
+ -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
+ -Djava.io.tmpdir=/druid/data
+ -Xmx1024M
+ -Xms1024M
+ log4j2.xml: |-
+ <?xml version="1.0" encoding="UTF-8" ?>
+ <Configuration status="WARN">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{ISO8601} %p [%t] %c - %m%n"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="info">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+ </Configuration>
+ runtime.properties: |
+ druid.port=8100
+ druid.service=druid/peon
+ druid.server.http.numThreads=5
+ druid.indexer.task.baseTaskDir=/druid/data
+ druid.indexer.runner.type=k8s
+ druid.peon.mode=remote
+ druid.indexer.task.encapsulatedTask=true
+ ```
+
Review Comment:
Thank you for adding these examples. I have not gone through them in detail yet, but there is another doc in docs/development/extensions-contrib/k8s-jobs.md that appears to attempt to answer similar things.
I think adding the examples to the linked page will be helpful, as they are published with the docs.
The README is also helpful as people will come to this file when they hear about the extension, so you could have the README just link out to the other page.
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
Review Comment:
I think this should be Option 2. Since overlords and peons have such different needs, it seems likely that most users will not want this behavior.
Is there a reason why someone would prefer this method over specifying a pod template in the overlord?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1280211651
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
Review Comment:
https://home.robusta.dev/blog/stop-using-cpu-limits - I read this blog post that seems to advise against setting CPU limits as long as requests are set on all pods. I don't feel strongly about updating the example to remove the limits.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1279358303
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
Review Comment:
that depends on what you are doing but usually it's best practice to do so
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1280215435
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ sidecar.istio.io/proxyCPU: "512m" # to handle a injected istio sidecar
+ labels:
+ app.kubernetes.io/name: "druid-realtime-backend"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - configMap:
+ defaultMode: 420
+ name: druid-tiny-cluster-peons-config
+ name: nodetype-config-volume
+ - emptyDir: {}
+ name: data-volume
+ - emptyDir: {}
+ name: deepstorage-volume
+```
+
+The below runtime properties need to be passed to the Job's peon process.
```
-apiVersion: rbac.authorization.k8s.io/v1
+druid.port=8100 (what port the peon should run on)
+druid.peon.mode=remote
+druid.service=druid/peon (for metrics reporting)
+druid.indexer.task.baseTaskDir=/druid/data (this should match the argument to the ./peon.sh run command in the PodTemplate)
+druid.indexer.runner.type=k8s
+druid.indexer.task.encapsulatedTask=true
+```
+
+Any runtime property or JVM config used by the peon process can also be passed. E.G. below is a example of a ConfigMap that can be used to generate the `nodetype-config-volume` mount in the above template.
+```
+kind: ConfigMap
+metadata:
+ name: druid-tiny-cluster-peons-config
+ namespace: default
+apiVersion: v1
+data:
+ jvm.config: |-
+ -server
+ -XX:MaxDirectMemorySize=1000M
+ -Duser.timezone=UTC
+ -Dfile.encoding=UTF-8
+ -Dlog4j.debug
+ -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
+ -Djava.io.tmpdir=/druid/data
+ -Xmx1024M
+ -Xms1024M
+ log4j2.xml: |-
+ <?xml version="1.0" encoding="UTF-8" ?>
+ <Configuration status="WARN">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{ISO8601} %p [%t] %c - %m%n"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="info">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+ </Configuration>
+ runtime.properties: |
+ druid.port=8100
+ druid.service=druid/peon
+ druid.server.http.numThreads=5
+ druid.indexer.task.baseTaskDir=/druid/data
+ druid.indexer.runner.type=k8s
+ druid.peon.mode=remote
+ druid.indexer.task.encapsulatedTask=true
+```
+
+
+Additional Configuration
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on PR #14674:
URL: https://github.com/apache/druid/pull/14674#issuecomment-1661049380
@AmatyaAvadhanula Since you are release manager for the 27.0 release - Can this be backported to the release branch so that the docs for the extension is updated with these examples
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s merged PR #14674:
URL: https://github.com/apache/druid/pull/14674
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions (druid)
Posted by "abhishekagarwal87 (via GitHub)" <gi...@apache.org>.
abhishekagarwal87 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1277308456
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=overlordSingleContainer (defaults to this if not specified)
+ druid.indexer.runner.k8s.adapter.type=overlordMultiContainer (same as overlordSingleContainer except sidecars are respected)
+ ```
+ Additional overlord runtime properties
+ ```
+ druid.indexer.runner.javaOptsArray=[] (JVM args for the peon running in the Job, If -Xmx is specified, the adapter will attempt to scale the Kubernetes requests of the pod to correspond with it)
+ druid.indexer.runner.labels={} (Additional labels to add to the Job)
+ druid.indexer.runner.annotations={} (Additional annotations to add to the Job)
+ druid.indexer.runner.peonMonitors={} (Override the list of Druid monitors for the peon, otherwise the overlord's list will be used)
+ ```
+
+ #### Option 2. Bring your own pod template to use as the base job pod template
+ This adapter expects a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system.
+ This pod template is used as the base of the job template (additional info like the task id is injected on top of it).
+ You can override things like labels, environment variables, resources, annotation, or even the base image with this template.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=customTemplateAdapter
+ druid.indexer.runner.k8s.podTemplate.base=/opt/druid/conf/druid/cluster/pod-template.yaml` (location of pod template on overlord)
+ ```
+
+ The following PodTemplate is an example that uses the regular druid docker image.
+ ```
+ apiVersion: "v1"
+ kind: "PodTemplate"
+ template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - configMap:
+ defaultMode: 420
+ name: druid-tiny-cluster-peons-config
+ name: nodetype-config-volume
+ - emptyDir: {}
+ name: data-volume
+ - emptyDir: {}
+ name: deepstorage-volume
+ ```
+
+ Runtime properties that need to be passed to the Job's peon process
+
+ ```
+ druid.port=8100 (what port the peon should run on)
+ druid.peon.mode=remote
+ druid.service=druid/peon (for metrics reporting)
+ druid.indexer.task.baseTaskDir=/druid/data (this should match the argument to the ./peon.sh run command in the PodTemplate)
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ ```
+
+ Any runtime property or jvm config used by the peon process can also be passed here
+
+ E.G. below is a example of a ConfigMap that can be used to generate the nodetype-config-volume mount in the above template.
+ ```
+ kind: ConfigMap
+ metadata:
+ name: druid-tiny-cluster-peons-config
+ namespace: default
+ apiVersion: v1
Review Comment:
```suggestion
metadata:
name: druid-tiny-cluster-peons-config
namespace: default
apiVersion: v1
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1277681298
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
Review Comment:
IMO this method is best used for testing the scheduling capability of the K8s runner or for quick startup (it's easier to run than having to inject a pod template)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1278140142
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
Review Comment:
This seems a little confusing. Should `peon.sh` be updated (not as part of this change) to look for runtime properties in another location for the peons?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1279366020
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
Review Comment:
there was also 1G of direct mem so this is a pretty reasonable request i think
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1280211651
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
Review Comment:
https://home.robusta.dev/blog/stop-using-cpu-limits - I read this blog post that seems to advise against setting CPU limits
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1280207718
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
Review Comment:
oops, missed the 1G of direct memory
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1280831125
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
Review Comment:
i would say my intention with this template is to show all the possible configurations you can set on the pod template, it's easier to see the configuration in docs and look up what it does and remove it if not needed than to try to figure out if a property you found somewhere else can be set
it's not necessarily intended to be a recommended configuration
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1277682025
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=overlordSingleContainer (defaults to this if not specified)
+ druid.indexer.runner.k8s.adapter.type=overlordMultiContainer (same as overlordSingleContainer except sidecars are respected)
+ ```
+ Additional overlord runtime properties
+ ```
+ druid.indexer.runner.javaOptsArray=[] (JVM args for the peon running in the Job, If -Xmx is specified, the adapter will attempt to scale the Kubernetes requests of the pod to correspond with it)
+ druid.indexer.runner.labels={} (Additional labels to add to the Job)
+ druid.indexer.runner.annotations={} (Additional annotations to add to the Job)
+ druid.indexer.runner.peonMonitors={} (Override the list of Druid monitors for the peon, otherwise the overlord's list will be used)
+ ```
+
+ #### Option 2. Bring your own pod template to use as the base job pod template
+ This adapter expects a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system.
+ This pod template is used as the base of the job template (additional info like the task id is injected on top of it).
+ You can override things like labels, environment variables, resources, annotation, or even the base image with this template.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=customTemplateAdapter
+ druid.indexer.runner.k8s.podTemplate.base=/opt/druid/conf/druid/cluster/pod-template.yaml` (location of pod template on overlord)
+ ```
+
+ The following PodTemplate is an example that uses the regular druid docker image.
+ ```
+ apiVersion: "v1"
+ kind: "PodTemplate"
+ template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - configMap:
+ defaultMode: 420
+ name: druid-tiny-cluster-peons-config
+ name: nodetype-config-volume
+ - emptyDir: {}
+ name: data-volume
+ - emptyDir: {}
+ name: deepstorage-volume
+ ```
+
+ Runtime properties that need to be passed to the Job's peon process
+
+ ```
+ druid.port=8100 (what port the peon should run on)
+ druid.peon.mode=remote
+ druid.service=druid/peon (for metrics reporting)
+ druid.indexer.task.baseTaskDir=/druid/data (this should match the argument to the ./peon.sh run command in the PodTemplate)
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ ```
+
+ Any runtime property or jvm config used by the peon process can also be passed here
+
+ E.G. below is a example of a ConfigMap that can be used to generate the nodetype-config-volume mount in the above template.
+ ```
+ kind: ConfigMap
+ metadata:
+ name: druid-tiny-cluster-peons-config
+ namespace: default
+ apiVersion: v1
+ data:
+ jvm.config: |-
+ -server
+ -XX:MaxDirectMemorySize=1000M
+ -Duser.timezone=UTC
+ -Dfile.encoding=UTF-8
+ -Dlog4j.debug
+ -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
+ -Djava.io.tmpdir=/druid/data
+ -Xmx1024M
+ -Xms1024M
+ log4j2.xml: |-
+ <?xml version="1.0" encoding="UTF-8" ?>
+ <Configuration status="WARN">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{ISO8601} %p [%t] %c - %m%n"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="info">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+ </Configuration>
+ runtime.properties: |
+ druid.port=8100
+ druid.service=druid/peon
+ druid.server.http.numThreads=5
+ druid.indexer.task.baseTaskDir=/druid/data
+ druid.indexer.runner.type=k8s
+ druid.peon.mode=remote
+ druid.indexer.task.encapsulatedTask=true
+ ```
+
Review Comment:
i didn't notice that file, will take a look
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1277680137
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=overlordSingleContainer (defaults to this if not specified)
+ druid.indexer.runner.k8s.adapter.type=overlordMultiContainer (same as overlordSingleContainer except sidecars are respected)
+ ```
+ Additional overlord runtime properties
+ ```
+ druid.indexer.runner.javaOptsArray=[] (JVM args for the peon running in the Job, If -Xmx is specified, the adapter will attempt to scale the Kubernetes requests of the pod to correspond with it)
+ druid.indexer.runner.labels={} (Additional labels to add to the Job)
+ druid.indexer.runner.annotations={} (Additional annotations to add to the Job)
+ druid.indexer.runner.peonMonitors={} (Override the list of Druid monitors for the peon, otherwise the overlord's list will be used)
+ ```
+
+ #### Option 2. Bring your own pod template to use as the base job pod template
+ This adapter expects a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system.
+ This pod template is used as the base of the job template (additional info like the task id is injected on top of it).
+ You can override things like labels, environment variables, resources, annotation, or even the base image with this template.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=customTemplateAdapter
+ druid.indexer.runner.k8s.podTemplate.base=/opt/druid/conf/druid/cluster/pod-template.yaml` (location of pod template on overlord)
+ ```
+
+ The following PodTemplate is an example that uses the regular druid docker image.
+ ```
+ apiVersion: "v1"
+ kind: "PodTemplate"
+ template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
Review Comment:
this is from the druid docker image https://github.com/apache/druid/blob/master/distribution/docker/peon.sh, although if you build your own docker image the command might be different
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1277716583
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,222 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+# Kubernetes Task Scheduling Extension
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+## How the Kubernetes Task Scheduler works.
+The Kubernetes Task Scheduler replaces the HTTP or Zookeeper based task runner (which both send tasks to workers) on the overlord.
+Based on which TaskAdapter (`druid.indexer.runner.k8s.adapter.type`) is selected, every task that the overlord runs is transformed into a Kubernetes Job that runs
+the Druid peon process for that task and then exits. The overlord then watches the K8s API for the Job's success or failure.
+
+## Configuration
+
+## Enabling
+1. Create a role binding for the overlord's service account that provides the needed permissions for interacting with Kubernetes.
+ ```
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ namespace: <druid-namespace>
+ name: druid-k8s-task-scheduler
+ rules:
+ - apiGroups: ["batch"]
+ resources: ["jobs"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ - apiGroups: [""]
+ resources: ["pods", "pods/log"]
+ verbs: ["get", "watch", "list", "delete", "create"]
+ ---
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ metadata:
+ name: druid-k8s-binding
+ namespace: <druid-namespace>
+ subjects:
+ - kind: ServiceAccount
+ name: <druid-overlord-k8s-service-account>
+ namespace: <druid-namespace>
+ roleRef:
+ kind: Role
+ name: druid-k8s-task-scheduler
+ apiGroup: rbac.authorization.k8s.io
+ ```
+
+2. Configure the overlord's runtime properties to use the Kubernetes task scheduler.
+ ```
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
+ druid.indexer.runner.namespace=<druid-namespace>
+ druid.indexer.runner.capacity=100 (number of concurrent jobs that can be sent to kubernetes at once)
+ ```
+
+3. Choose a Task Adapter (determines how tasks will be converted to a Kubernetes Job)
+ #### Option 1. Copy the overlord's pod template to use as the base job template
+ This adapter takes the overlord's own pod specification and injects needed information (like the task id) on top of it.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=overlordSingleContainer (defaults to this if not specified)
+ druid.indexer.runner.k8s.adapter.type=overlordMultiContainer (same as overlordSingleContainer except sidecars are respected)
+ ```
+ Additional overlord runtime properties
+ ```
+ druid.indexer.runner.javaOptsArray=[] (JVM args for the peon running in the Job, If -Xmx is specified, the adapter will attempt to scale the Kubernetes requests of the pod to correspond with it)
+ druid.indexer.runner.labels={} (Additional labels to add to the Job)
+ druid.indexer.runner.annotations={} (Additional annotations to add to the Job)
+ druid.indexer.runner.peonMonitors={} (Override the list of Druid monitors for the peon, otherwise the overlord's list will be used)
+ ```
+
+ #### Option 2. Bring your own pod template to use as the base job pod template
+ This adapter expects a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system.
+ This pod template is used as the base of the job template (additional info like the task id is injected on top of it).
+ You can override things like labels, environment variables, resources, annotation, or even the base image with this template.
+
+ Required overlord runtime properties
+ ```
+ druid.indexer.runner.k8s.adapter.type=customTemplateAdapter
+ druid.indexer.runner.k8s.podTemplate.base=/opt/druid/conf/druid/cluster/pod-template.yaml` (location of pod template on overlord)
+ ```
+
+ The following PodTemplate is an example that uses the regular druid docker image.
+ ```
+ apiVersion: "v1"
+ kind: "PodTemplate"
+ template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - configMap:
+ defaultMode: 420
+ name: druid-tiny-cluster-peons-config
+ name: nodetype-config-volume
+ - emptyDir: {}
+ name: data-volume
+ - emptyDir: {}
+ name: deepstorage-volume
+ ```
+
+ Runtime properties that need to be passed to the Job's peon process
+
+ ```
+ druid.port=8100 (what port the peon should run on)
+ druid.peon.mode=remote
+ druid.service=druid/peon (for metrics reporting)
+ druid.indexer.task.baseTaskDir=/druid/data (this should match the argument to the ./peon.sh run command in the PodTemplate)
+ druid.indexer.runner.type=k8s
+ druid.indexer.task.encapsulatedTask=true
Review Comment:
i wanted to be clear that those properties are required, (the peon will fail without them), hopefully we can remove some of them in the future since a lot of them are not necesary
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1278114114
##########
website/static/css/custom.css:
##########
@@ -99,15 +99,3 @@ article iframe {
margin-right: auto;
max-width: 100%;
}
-.getAPI {
- color: #0073e6;
- font-weight: bold;
-}
-.postAPI {
- color: #00bf7d;
- font-weight: bold;
-}
-.deleteAPI {
- color: #f49200;
- font-weight: bold;
-}
Review Comment:
accidental change?
##########
extensions-contrib/kubernetes-overlord-extensions/README.md:
##########
@@ -0,0 +1,32 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+druid-kubernetes-overlord-extensions
+=============
+
+Overview
+=============
+The Kubernetes Task Scheduling extension allows a Druid cluster running on Kubernetes to schedule
+its tasks as Kubernetes Jobs instead of sending them to workers (middle managers or indexers).
+
+Documentation
+=============
+See the druid.apache.org website or under [Druid GitHub Repo](https://github.com/apache/druid/blob/master/docs/development/extensions-contrib/k8s-jobs.md).
Review Comment:
```suggestion
More detailed documentation about how to configure and use the extension is available [here](../../docs/development/extensions-contrib/k8s-jobs.md)
```
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
Review Comment:
```suggestion
Task specific pod templates can be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
```
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - configMap:
+ defaultMode: 420
+ name: druid-tiny-cluster-peons-config
+ name: nodetype-config-volume
+ - emptyDir: {}
+ name: data-volume
+ - emptyDir: {}
+ name: deepstorage-volume
+```
+
+The below runtime properties need to be passed to the Job's peon process.
```
-apiVersion: rbac.authorization.k8s.io/v1
+druid.port=8100 (what port the peon should run on)
+druid.peon.mode=remote
+druid.service=druid/peon (for metrics reporting)
+druid.indexer.task.baseTaskDir=/druid/data (this should match the argument to the ./peon.sh run command in the PodTemplate)
+druid.indexer.runner.type=k8s
+druid.indexer.task.encapsulatedTask=true
+```
+
+Any runtime property or JVM config used by the peon process can also be passed. E.G. below is a example of a ConfigMap that can be used to generate the `nodetype-config-volume` mount in the above template.
+```
+kind: ConfigMap
+metadata:
+ name: druid-tiny-cluster-peons-config
+ namespace: default
+apiVersion: v1
+data:
+ jvm.config: |-
+ -server
+ -XX:MaxDirectMemorySize=1000M
+ -Duser.timezone=UTC
+ -Dfile.encoding=UTF-8
+ -Dlog4j.debug
+ -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
+ -Djava.io.tmpdir=/druid/data
+ -Xmx1024M
+ -Xms1024M
+ log4j2.xml: |-
+ <?xml version="1.0" encoding="UTF-8" ?>
+ <Configuration status="WARN">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{ISO8601} %p [%t] %c - %m%n"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="info">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+ </Configuration>
+ runtime.properties: |
+ druid.port=8100
+ druid.service=druid/peon
+ druid.server.http.numThreads=5
+ druid.indexer.task.baseTaskDir=/druid/data
+ druid.indexer.runner.type=k8s
+ druid.peon.mode=remote
+ druid.indexer.task.encapsulatedTask=true
+```
+
+
+Additional Configuration
+### Properties
+|Property| Possible Values | Description |Default|required|
+|--------|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|--------|
+|`druid.indexer.runner.debugJobs`| `boolean` | Clean up K8s jobs after tasks complete. |False|No|
+|`druid.indexer.runner.sidecarSupport`| `boolean` | Deprecated, specify adapter type as runtime property `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` instead. If your overlord pod has sidecars, this will attempt to start the task with the same sidecars as the overlord pod. |False|No|
+|`druid.indexer.runner.primaryContainerName`| `String` | If running with sidecars, the `primaryContainerName` should be that of your druid container like `druid-overlord`. |First container in `podSpec` list|No|
+|`druid.indexer.runner.kubexitImage`| `String` | Used kubexit project to help shutdown sidecars when the main pod completes. Otherwise jobs with sidecars never terminate. |karlkfi/kubexit:latest|No|
+|`druid.indexer.runner.disableClientProxy`| `boolean` | Use this if you have a global http(s) proxy and you wish to bypass it. |false|No|
+|`druid.indexer.runner.maxTaskDuration`| `Duration` | Max time a task is allowed to run for before getting killed |`PT4H`|No|
+|`druid.indexer.runner.taskCleanupDelay`| `Duration` | How long do jobs stay around before getting reaped from K8s |`P2D`|No|
+|`druid.indexer.runner.taskCleanupInterval`| `Duration` | How often to check for jobs to be reaped |`PT10M`|No|
+|`druid.indexer.runner.K8sjobLaunchTimeout`| `Duration` | How long to wait to launch a K8s task before marking it as failed, on a resource constrained cluster it may take some time. |`PT1H`|No|
+|`druid.indexer.runner.javaOptsArray`| `JsonArray` | java opts for the task. |`-Xmx1g`|No|
+|`druid.indexer.runner.labels`| `JsonObject` | Additional labels you want to add to peon pod |`{}`|No|
+|`druid.indexer.runner.annotations`| `JsonObject` | Additional annotations you want to add to peon pod |`{}`|No|
+|`druid.indexer.runner.peonMonitors`| `JsonArray` | Overrides `druid.monitoring.monitors`. Use this property if you don't want to inherit monitors from the Overlord. |`[]`|No|
+|`druid.indexer.runner.graceTerminationPeriodSeconds`| `Long` | Number of seconds you want to wait after a sigterm for container lifecycle hooks to complete. Keep at a smaller value if you want tasks to hold locks for shorter periods. |`PT30S` (K8s default)|No|
+|`druid.indexer.runner.capacity`| `Integer` | Number of concurrent jobs that can be sent to Kubernetes. |`2147483647 `|No|
Review Comment:
```suggestion
|`druid.indexer.runner.capacity`| `Integer` | Number of concurrent jobs that can be sent to Kubernetes. |`2147483647`|No|
```
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
Review Comment:
Can you explain what these settings are please
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
Review Comment:
Can you provide a real world example of an annotation that would be helpful in the template. Same comment about the labels.
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -28,85 +28,45 @@ Consider this an [EXPERIMENTAL](../experimental.md) feature mostly because it ha
## How it works
-The K8s extension builds a pod spec using the specified pod adapter, the default implementation takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. Thus if you have sidecars such as Splunk or Istio it can optionally launch a task as a K8s job. All jobs are natively restorable, they are decoupled from the druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
+The K8s extension builds a pod spec from each task using the specified pod adapter. All jobs are natively restorable, they are decoupled from the druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
Review Comment:
```suggestion
The K8s extension builds a pod spec for each task using the specified pod adapter. All jobs are natively restorable, they are decoupled from the Druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
```
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
Review Comment:
This seems a little confusing. Should `peon.sh` to look for runtime properties in another location for the peons?
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
Review Comment:
This requests seems high given that Xmx is 1G below. Does it need to be this high?
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
Review Comment:
Do we need to set a limit?
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
Review Comment:
```suggestion
image: apache/druid:{{DRUIDVERSION}}
```
There is a script that runs and replaces {{DRUIDVERSION}} with the version of the docs where this is published
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -28,85 +28,45 @@ Consider this an [EXPERIMENTAL](../experimental.md) feature mostly because it ha
## How it works
-The K8s extension builds a pod spec using the specified pod adapter, the default implementation takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. Thus if you have sidecars such as Splunk or Istio it can optionally launch a task as a K8s job. All jobs are natively restorable, they are decoupled from the druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
+The K8s extension builds a pod spec from each task using the specified pod adapter. All jobs are natively restorable, they are decoupled from the druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
-## Pod Adapters
-The logic defining how the pod template is built for your kubernetes job depends on which pod adapter you have specified.
-
-### Overlord Single Container Pod Adapter
-The overlord single container pod adapter takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. This is the default pod adapter implementation, to explicitly enable it you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: overlordSingleContainer`
-
-### Overlord Multi Container Pod Adapter
-The overlord multi container pod adapter takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. It uses kubexit to manage dependency ordering between the main container that runs your druid peon and other sidecars defined in the `Overlord` pod spec. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer`
-
-### Custom Template Pod Adapter
-The custom template pod adapter allows you to specify a pod template file per task type. This adapter requires you to specify a `base` pod spec which will be used in the case that a task specific pod spec has not been defined. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
-
-The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
-Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
## Configuration
To use this extension please make sure to [include](../../configuration/extensions.md#loading-extensions)`druid-kubernetes-overlord-extensions` in the extensions load list for your overlord process.
-The extension uses the task queue to limit how many concurrent tasks (K8s jobs) are in flight so it is required you have a reasonable value for `druid.indexer.queue.maxSize`. Additionally set the variable `druid.indexer.runner.namespace` to the namespace in which you are running druid.
+The extension uses `druid.indexer.runner.capacity` to limit the number of k8s jobs in flight. You should set this to a reasonable value. Additionally set the variable `druid.indexer.runner.namespace` to the namespace in which you are running druid.
Review Comment:
```suggestion
The extension uses `druid.indexer.runner.capacity` to limit the number of concurrent peons running in the Kubernetes cluster. Setting this value too high can cause the overlord to be OOMKilled as it spawns more threads to keep track of the peons.
```
> Additionally set the variable `druid.indexer.runner.namespace` to the namespace in which you are running druid.
It feels like this belongs on the next line with the rest of the required configuration
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -28,85 +28,45 @@ Consider this an [EXPERIMENTAL](../experimental.md) feature mostly because it ha
## How it works
-The K8s extension builds a pod spec using the specified pod adapter, the default implementation takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. Thus if you have sidecars such as Splunk or Istio it can optionally launch a task as a K8s job. All jobs are natively restorable, they are decoupled from the druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
+The K8s extension builds a pod spec from each task using the specified pod adapter. All jobs are natively restorable, they are decoupled from the druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
-## Pod Adapters
-The logic defining how the pod template is built for your kubernetes job depends on which pod adapter you have specified.
-
-### Overlord Single Container Pod Adapter
-The overlord single container pod adapter takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. This is the default pod adapter implementation, to explicitly enable it you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: overlordSingleContainer`
-
-### Overlord Multi Container Pod Adapter
-The overlord multi container pod adapter takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. It uses kubexit to manage dependency ordering between the main container that runs your druid peon and other sidecars defined in the `Overlord` pod spec. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer`
-
-### Custom Template Pod Adapter
-The custom template pod adapter allows you to specify a pod template file per task type. This adapter requires you to specify a `base` pod spec which will be used in the case that a task specific pod spec has not been defined. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
-
-The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
-Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
## Configuration
To use this extension please make sure to [include](../../configuration/extensions.md#loading-extensions)`druid-kubernetes-overlord-extensions` in the extensions load list for your overlord process.
-The extension uses the task queue to limit how many concurrent tasks (K8s jobs) are in flight so it is required you have a reasonable value for `druid.indexer.queue.maxSize`. Additionally set the variable `druid.indexer.runner.namespace` to the namespace in which you are running druid.
+The extension uses `druid.indexer.runner.capacity` to limit the number of k8s jobs in flight. You should set this to a reasonable value. Additionally set the variable `druid.indexer.runner.namespace` to the namespace in which you are running druid.
Review Comment:
> You should set this to a reasonable value.
Can we include some guidance on what is reasonable. I think mentioning that having this set to infinite means that the overlord will have more threads will be useful for an operator to tune their cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1279345659
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -28,85 +28,45 @@ Consider this an [EXPERIMENTAL](../experimental.md) feature mostly because it ha
## How it works
-The K8s extension builds a pod spec using the specified pod adapter, the default implementation takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. Thus if you have sidecars such as Splunk or Istio it can optionally launch a task as a K8s job. All jobs are natively restorable, they are decoupled from the druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
+The K8s extension builds a pod spec from each task using the specified pod adapter. All jobs are natively restorable, they are decoupled from the druid deployment, thus restarting pods or doing upgrades has no affect on tasks in flight. They will continue to run and when the overlord comes back up it will start tracking them again.
-## Pod Adapters
-The logic defining how the pod template is built for your kubernetes job depends on which pod adapter you have specified.
-
-### Overlord Single Container Pod Adapter
-The overlord single container pod adapter takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. This is the default pod adapter implementation, to explicitly enable it you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: overlordSingleContainer`
-
-### Overlord Multi Container Pod Adapter
-The overlord multi container pod adapter takes the podSpec of your `Overlord` pod and creates a kubernetes job from this podSpec. It uses kubexit to manage dependency ordering between the main container that runs your druid peon and other sidecars defined in the `Overlord` pod spec. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer`
-
-### Custom Template Pod Adapter
-The custom template pod adapter allows you to specify a pod template file per task type. This adapter requires you to specify a `base` pod spec which will be used in the case that a task specific pod spec has not been defined. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
-
-The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
-Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
## Configuration
To use this extension please make sure to [include](../../configuration/extensions.md#loading-extensions)`druid-kubernetes-overlord-extensions` in the extensions load list for your overlord process.
-The extension uses the task queue to limit how many concurrent tasks (K8s jobs) are in flight so it is required you have a reasonable value for `druid.indexer.queue.maxSize`. Additionally set the variable `druid.indexer.runner.namespace` to the namespace in which you are running druid.
+The extension uses `druid.indexer.runner.capacity` to limit the number of k8s jobs in flight. You should set this to a reasonable value. Additionally set the variable `druid.indexer.runner.namespace` to the namespace in which you are running druid.
Review Comment:
do you think "the same number as the total # of mm capacity slots" is a okay recommendation here? maybe leaving a note that having this too high may cause some memory issues due to # of threads?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1279357449
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
Review Comment:
i think it would probably make sense, i can do this in a separate pr
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add readme for kubernetes-overlord-extensions and update docs (druid)
Posted by "georgew5656 (via GitHub)" <gi...@apache.org>.
georgew5656 commented on code in PR #14674:
URL: https://github.com/apache/druid/pull/14674#discussion_r1279369601
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
Review Comment:
this is the user the druid process runs on. i think we specify 1000 here because that user is created in the druid docker image that i used in this example.
##########
docs/development/extensions-contrib/k8s-jobs.md:
##########
@@ -115,33 +75,197 @@ You can keep your Dockerfile the same but you must have a sidecar spec like so:
- arg2
```
-The following roles must also be accessible. An example spec could be:
+For both of these adapters, you can add optional labels to your K8s jobs / pods if you need them by using the following configuration:
+`druid.indexer.runner.labels: '{"key":"value"}'`
+Annotations are the same with:
+`druid.indexer.runner.annotations: '{"key":"value"}'`
+
+All other configurations you had for the middle manager tasks must be moved under the overlord with one caveat, you must specify javaOpts as an array:
+`druid.indexer.runner.javaOptsArray`, `druid.indexer.runner.javaOpts` is no longer supported.
+
+If you are running without a middle manager you need to also use `druid.processing.intermediaryData.storage.type=deepstore`
+
+### Custom Template Pod Adapter
+The custom template pod adapter allows you to specify a pod template file per task type for more flexibility on how to define your pods. This adapter expects a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) to be available on the overlord's file system. This pod template is used as the base of the pod spec for the Kubernetes Job. You can override things like labels, environment variables, resources, annotation, or even the base image with this template. To enable this pod adapter you can specify the runtime property `druid.indexer.runner.k8s.adapter.type: customTemplateAdapter`
+
+The base pod template must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.base: /path/to/basePodSpec.yaml`
+
+Task specific pod templates must be specified as the runtime property `druid.indexer.runner.k8s.podTemplate.{taskType}: /path/to/taskSpecificPodSpec.yaml` where {taskType} is the name of the task type i.e `index_parallel`
+
+The following is an example Pod Template that uses the regular druid docker image.
+```
+apiVersion: "v1"
+kind: "PodTemplate"
+template:
+ metadata:
+ annotations:
+ custom-annotation: "hello"
+ labels:
+ custom-label: "hello"
+ spec:
+ affinity: {}
+ containers:
+ - command:
+ - sh
+ - -c
+ - |
+ /peon.sh /druid/data 1
+ env:
+ - name: CUSTOM_ENV_VARIABLE
+ value: "hello"
+ image: apache/druid:26.0.0
+ name: main
+ ports:
+ - containerPort: 8091
+ name: druid-tls-port
+ protocol: TCP
+ - containerPort: 8100
+ name: druid-port
+ protocol: TCP
+ resources:
+ limits:
+ cpu: "1"
+ memory: 2400M
+ requests:
+ cpu: "1"
+ memory: 2400M
+ volumeMounts:
+ - mountPath: /opt/druid/conf/druid/cluster/master/coordinator-overlord # runtime props are still mounted in this location because that's where peon.sh looks for configs
+ name: nodetype-config-volume
+ readOnly: true
+ - mountPath: /druid/data
+ name: data-volume
+ - mountPath: /druid/deepstorage
+ name: deepstorage-volume
+ restartPolicy: "Never"
+ securityContext:
+ fsGroup: 1000
+ runAsGroup: 1000
+ runAsUser: 1000
Review Comment:
this is the user the druid process runs under. i think we specify 1000 here because that user is created in the druid docker image that i used in this example.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org