<p>I have deployed a pod with cpu/memory limit on the spec:</p>
<pre><code>resources:
            requests:
              cpu: 1
              memory: 4Gi
</code></pre>
<p>but the limit looks different from <code>kubectl describe pod</code> command:</p>
<pre><code>Init Containers:
  elastic-internal-init-filesystem:
    Container ID:  docker://174be47d381c76b64ba406d1e1a80c685fca407a926074df32d8dd5689f359f2
    Image:         docker.elastic.co/elasticsearch/elasticsearch:7.15.2
    Image ID:      docker-pullable://docker.elastic.co/elasticsearch/elasticsearch@sha256:a1dce08d504b22e87adc849c94dcae53f6a0bd12648a4d99d7f9fc07bb2e8a3e
    Port:          &lt;none&gt;
    Host Port:     &lt;none&gt;
    Command:
      bash
      -c
      /mnt/elastic-internal/scripts/prepare-fs.sh
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Wed, 31 May 2023 10:42:34 +1000
      Finished:     Wed, 31 May 2023 10:42:36 +1000
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     100m
      memory:  50Mi
    Requests:
      cpu:     100m
      memory:  50Mi
</code></pre>
<p>The <code>describe</code> command returns 100m cpu and 50Mi memory. However I requested 4G memory and 1 cpu. Why doesn't it use the limit from the spec file?</p>
<p>The full spec file is:</p>
<pre><code>apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: elk
spec:
  version: 7.15.2
  serviceAccountName: docker-sa
  http:
    tls:
      selfSignedCertificate:
        disabled: true
  nodeSets:
  - name: node
    count: 2
    config:
      network.host: 0.0.0.0
      xpack.security.enabled: false
      # xpack.security.http.ssl.enabled: false
      # xpack.security.transport.ssl.enabled: false
    podTemplate:
      spec:
        initContainers:
        - name: sysctl
          securityContext:
            privileged: true
          command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
        containers:
        - name: elasticsearch
          readinessProbe:
            exec:
              command:
              - bash
              - -c
              - /mnt/elastic-internal/scripts/readiness-probe-script.sh
            failureThreshold: 3
            initialDelaySeconds: 10
            periodSeconds: 12
            successThreshold: 1
            timeoutSeconds: 12
          env:
          - name: READINESS_PROBE_TIMEOUT
            value: &quot;120&quot;
          resources:
            requests:
              cpu: 1
              memory: 4Gi
          volumeMounts:
          - name: elasticsearch-data
            mountPath: /usr/share/elasticsearch/data
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: ebs-sc
        resources:
          requests:
            storage: 512Gi

</code></pre>

Joey Yi Zhao
<p>Resources are per container, not per pod.  Your spec has 2 containers, with resource request only for the second (non-init) container.</p>
<p>Your 'describe' output only shows the init container. Though actually, it doesn't seem to be the init container named in your spec.</p>
