Open sp-matrix opened 2 years ago
this looks like kubernetes is complaining about your Pod spec for the application. do you have both requests
and limits
defined in the pod.spec.containers[0].resoures
?
could you share the Pod or Deployment spec you are using?
Thank you @elmiko for the reply.
I am getting into the operator in OC and then submitting the application in UI. While submitting, below is my complete .yaml configuration.
apiVersion: radanalytics.io/v1 kind: SparkApplication metadata: name: my-spark-app namespace: xxx-np spec: mainApplicationFile: 'local:///opt/spark/examples/jars/spark-examples_2.11-2.4.5.jar' mainClass: org.apache.spark.examples.SparkPi driver: cores: 0.2 coreLimit: 500m executor: coreLimit: 1000m coreRequest: 0.5 cores: 1 cpuLimit: 1000m instances: 1
Not using the requests and limits options in the .yaml.
it's possible we have a bug in that logic for the requests/limits
@elmiko Is there any workaround ?
i need to see more details about the Pod and Deployments that are being created, knowing the SparkApplication yaml is not giving enough detail as it looks like the kubernetes API does not like the Pod definition.
would it be possible to share those records? (and please keep the formatting)
@elmiko : Update on the issue. I tried to run a spark application in the same namespace via spark-submit, when the 'executor.cores' is <= 0.4, I was able to run it, If i use value beyond 0.4 cpu for executors, it is failing. When I use operator, even though I set cpuRequest as 0.4 or less than 1, the default value 1 is set to executor cores. whereas I can pass any value greater than 1, but the available cpu is 0.4, it is failing.
Operator Deployment yaml :
kind: Deployment
apiVersion: apps/v1
metadata:
annotations:
deployment.kubernetes.io/revision: '1'
resourceVersion: '1876495850'
name: spark-operator
uid: 503bc9cd-ebdd-45c1-b575-e02fc04b8163
creationTimestamp: '2022-05-17T22:33:56Z'
generation: 2
managedFields:
Submitter POD's Log after submitting the application
cmd: $SPARK_HOME/bin/spark-submit --class org.apache.spark.examples.SparkPi --master k8s://https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT --conf spark.kubernetes.namespace=xxx-np --deploy-mode cluster --conf spark.app.name=my-spark-app --conf spark.kubernetes.container.image=quay.io/radanalyticsio/openshift-spark:2.4-latest --conf spark.kubernetes.submission.waitAppCompletion=false --conf spark.driver.cores=0.5 --conf spark.kubernetes.driver.limit.cores=500m --conf spark.driver.memory=512m --conf spark.kubernetes.authenticate.driver.serviceAccountName=spark-operator --conf spark.kubernetes.driver.label.version=2.3.0 --conf spark.kubernetes.driver.label.radanalytics.io/SparkApplication=my-spark-app --conf spark.kubernetes.executor.label.radanalytics.io/SparkApplication=my-spark-app --conf spark.kubernetes.driverEnv.APPLICATION_NAME=my-spark-app --conf spark.executorEnv.APPLICATION_NAME=my-spark-app --conf spark.executor.instances=1 --conf spark.executor.cores=1 --conf spark.executor.memory=512m --conf spark.jars.ivy=/tmp/.ivy2 local:///opt/spark/examples/jars/spark-examples_2.11-2.4.5.jar && echo -e
Thanks !
thanks for the report back @sp-matrix . it sounds like we might have a bug in the operator around converting the cpu cores value properly. i haven't looked at this code in awhile so i can't predict any sort of fix, but it certainly sounds like we are not converting the value properly.
Hello,
The operator was installed in our openshift cluster (organization). When the example spark application (spark-examples_2.11-2.4.5.jar) was submitted with the help of operator, submitter pod and driver pod was getting created but the executor pod is not getting created and failing with the below error.
INFO ExecutorPodsAllocator: Going to request 1 executors from Kubernetes. ERROR Utils: Uncaught exception in thread kubernetes-executor-snapshots-subscribers-1 io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://kubernetes.default.svc/api/v1/namespaces/nm/pods. Message: Pod "my-spark-app-1653416287945-exec-4" is invalid: spec.containers[0].resources.requests: Invalid value: "1": must be less than or equal to cpu limit. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.containers[0].resources.requests, message=Invalid value: "1": must be less than or equal to cpu limit, reason=FieldValueInvalid, additionalProperties={})], group=null, kind=Pod, name=my-spark-app-1653416287945-exec-4, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Pod "my-spark-app-1653416287945-exec-4" is invalid: spec.containers[0].resources.requests: Invalid value: "1": must be less than or equal to cpu limit, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure
After going through the documentation, we tried limiting the CPU and core but the issue is not getting resolved.
SparkApplication yaml: ... ... spec: driver: coreLimit: 500m cores: 0.2 executor: coreLimit: 1000m coreRequest: 0.5 cores: 1 # we can't give below 1 (float values), when we skip this parameter the default value 1 is assigned. cpuLimit: 1000m instances: 1 ...
In configmap of the driver:
spark.executor.memory=512m spark.driver.blockManager.port=7079 spark.ui.reverseProxy=true spark.executorEnv.APPLICATION_NAME=my-spark-app spark.kubernetes.container.image=quay.io/radanalyticsio/openshift-spark\:2.4-latest spark.jars=/opt/spark/examples/jars/spark-examples_2.11-2.4.5.jar spark.ui.reverseProxyUrl=/ spark.kubernetes.driver.limit.cores=500m spark.kubernetes.submitInDriver=true spark.driver.memory=512m spark.submit.deployMode=cluster spark.kubernetes.driverEnv.APPLICATION_NAME=my-spark-app spark.kubernetes.executor.label.radanalytics.io/SparkApplication=my-spark-app spark.kubernetes.driver.label.radanalytics.io/SparkApplication=my-spark-app spark.executor.cores=1 spark.kubernetes.authenticate.driver.serviceAccountName=spark-operator spark.jars.ivy=/tmp/.ivy2 spark.kubernetes.driver.pod.name=my-spark-app-1653416287945-driver spark.executor.instances=1 spark.kubernetes.namespace=nm-np spark.app.id=spark-d7cd179d47a047dd9d11811a99e1060c spark.app.name=my-spark-app spark.kubernetes.driver.label.version=2.3.0 spark.driver.cores=0.2 spark.driver.port=7078
Note: we tried starting the service 'cluster-limreq' with 4 cpu limit for executors as mentioned in READme but the issue was not resolved.
Resource Quota of my namespace allocated by my cluster manager
Name: core-resource-limits-hermes Namespace: nm-np Type Resource Min Max Default Request Default Limit Max Limit/Request Ratio
Container cpu 25m 4 150m 400m - Container memory 25Mi 4Gi 256Mi 512Mi - Pod cpu 25m 4 - - - Pod memory 25Mi 4Gi - - -
Can anyone please help to find the reason why the executor Pod is not staring even though we request only 1 cpu from the allocated quota of 4 cpus.
Thanks!