Kubernetes pod able to exceed huge pages limit

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.27
Cloud being used: bare-metal

Hello,
I followed the instruction from Manage HugePages | Kubernetes to make huge pages available on a node by setting it in the grub file.

In my yaml file, I set the limit as follows

 containers:
      - name: foo2
        image: myrepo.comfoo2:latest
        volumeMounts:
        - mountPath: /hugepages
          name: hugepage
        resources:
          limits:
            hugepages-2Mi: 20Mi
            memory: 4000Mi
          requests:
            memory: 4000Mi
      - name: foo
        image: myrepo.com/foo:latest
      volumes:
      - name: hugepage
        emptyDir:
          medium: HugePages

However, my container is able to exceed the huge page limit of 20Mi set and use up 70 pages:

 grep -i hugepages /proc/meminfo
AnonHugePages:    200704 kB
ShmemHugePages:        0 kB
HugePages_Total:    3000
HugePages_Free:     2930
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

The pages are loaded to shared memory using huge pages:

------ Shared Memory Segments --------
key                shmid      owner      perms      bytes           nattch     status
0x0000200     17         root             600        145354312     2

How come the pod does not forbid the container from exceeding this limit?