<p>How does one go about setting resource limits in EMR on EKS? My driver pod is failing to launch because it is requesting more CPU than it is allowed. This doesn't make sense to me. I am running the getting started code from the docs below.</p>
<p>I have added <code>--conf spark.driver.limit.cores=2</code> in order to try and make the limit higher than what is listed in the error message below. I got this idea from here <a href="https://spark.apache.org/docs/latest/running-on-kubernetes.html#spark-properties" rel="nofollow noreferrer">https://spark.apache.org/docs/latest/running-on-kubernetes.html#spark-properties</a></p>
<p>This cluster does have istio running in it. I am not sure if that would cause issues.</p>
<p>Here is the code I am running to trigger the job</p>
<pre><code>aws emr-containers start-job-run \
  --virtual-cluster-id blahblah \
  --name pi-4 \
  --execution-role-arn arn:aws:iam::0000000000:role/blahblah_emr_eks_executor_role \
  --release-label emr-6.4.0-latest \
  --job-driver '{
    &quot;sparkSubmitJobDriver&quot;: {
      &quot;entryPoint&quot;: &quot;s3://us-east-1.elasticmapreduce/emr-containers/samples/wordcount/scripts/wordcount.py&quot;,
      &quot;entryPointArguments&quot;: [&quot;s3://blahblah/wordcount_output&quot;],
      &quot;sparkSubmitParameters&quot;: &quot;--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1 --conf spark.driver.limit.cores=2&quot;
    }
  }'
</code></pre>
<p>This causes the <code>job-runner</code> container to fail with the following:</p>
<hr />
<p>State:      Terminated
Reason:   Error
Message:  Exception in thread &quot;main&quot; io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: <a href="https://kubernetes.default.svc/api/v1/namespaces/spark/pods" rel="nofollow noreferrer">https://kubernetes.default.svc/api/v1/namespaces/spark/pods</a>. Message: Pod &quot;spark-00000002vepbpmi2hkv-driver&quot; is invalid: spec.containers[2].resources.requests: Invalid value: &quot;1&quot;: must be less than or equal to cpu limit. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.containers[2].resources.requests, message=Invalid value: &quot;1&quot;: must be less than or equal to cpu limit, reason=FieldValueInvalid, additionalProperties={})], group=null, kind=Pod, name=spark-00000002vepbpmi2hkv-driver, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Pod &quot;spark-00000002vepbpmi2hkv-driver&quot; is invalid: spec.containers[2].resources.requests: Invalid value: &quot;1&quot;: must be less than or equal to cpu limit, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}). at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:589)</p>
<hr />
<p>Any ideas on how to proceed?</p>

<p>I was able to figure it out.</p>
<pre><code>aws emr-containers start-job-run \
  --virtual-cluster-id=blahblah \
  --name=pi-4 \
  --execution-role-arn=arn:aws:iam::blahblahaccount:role/balblah_role_name \
  --release-label=emr-6.4.0-latest \
  --job-driver='{
    &quot;sparkSubmitJobDriver&quot;: {
      &quot;entryPoint&quot;: &quot;local:///usr/lib/spark/examples/src/main/python/pi.py&quot;,
      &quot;sparkSubmitParameters&quot;: &quot;--conf spark.executor.instances=1 --conf spark.executor.memory=2G --conf spark.executor.request.cores=1 --conf spark.kubernetes.executor.limit.cores=2 --conf spark.driver.request.cores=1 --conf spark.kubernetes.driver.limit.cores=2
    }
  }'
</code></pre>
<p>It seems that the aws docs are wrong and that the configuration values are actually as follows.</p>
<ul>
<li><code>--conf spark.{driver|executor}.request.cores</code></li>
<li><code>--conf spark.{driver|executor}.limit.cores</code></li>
</ul>
<p>However, the AWS docs has you pass in <code>--conf spark.driver.cores=1</code>. This value didn't seem to be acknowledged which I believe caused my error. The spark configuration docs below mention that <code>spark.driver.request.cores</code> have precedence over <code>spark.driver.cores</code>, which I think makes sense as the value was recognized when I passed that it.</p>
<p><a href="https://spark.apache.org/docs/latest/running-on-kubernetes.html#configuration" rel="nofollow noreferrer">https://spark.apache.org/docs/latest/running-on-kubernetes.html#configuration</a></p>
