First As describe here https://stackoverflow.com/questions/60079822/kubernetes-pods-and-cpu-limits when we do not specify the limit of CPU a pod can use all the CPUs of the node. Is this also apply for memory? Means does pod starts using the all memory when it required when we do not specify the limit?
Second Let's consider we have a single worker node with 2GB Memory, we have 8 pods deployed on this, is it correct to assign 256Mi request and limit to each of these 8 pods? Is it recommended to apply same limit on all pods?
Third what would happen if I want to create a new pod with same request and limit 256Mi? Will it always stay in pending state?
Means does pod starts using the all memory when it required when we do not specify the limit
Short answer is Yes. You probably want to look into QoS as well, pod without request/limit are assigned BestEffort; which will be first to evict when system is under stress.
is it correct to assign 256Mi request and limit to each of these 8 pods? Is it recommended to apply same limit on all pods?
If your pod needs that amount of memory to function then it is not a question of correct/incorrect. You should plan your cluster capacity instead.
Will it always stay in pending state?
You won't be able to use ALL memory in reality; the fact that you have many other programs running (eg. kubelet) on the same node. When you specified resources and there is no node that could meet this requirement your pod will enter pending state. If you don't specified the resource the scheduler will allocate your pod to run on one of the available node - which your pod may get kick-out when there is a higher priority, better QoS request come in, or simply suicide as the node won't satisfy the resources need.