Pod Connectivity
Create a namespace
Create a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.
kubectl create namespace mem-exampleTo specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.
In this exercise, you create a Pod that has one Container. The Container has a memory request of 100 MiB and a memory limit of 200 MiB. Here's the configuration file for the Pod:
Create the Pod:
kubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-exampleVerify that the Pod Container is running:
kubectl get pod memory-demo --namespace=mem-exampleView detailed information about the Pod:
kubectl get pod memory-demo --output=yaml --namespace=mem-exampleRun kubectl top to fetch the metrics for the pod:
kubectl top pod memory-demo --namespace=mem-exampleDelete your Pod:
kubectl delete pod memory-demo --namespace=mem-exampleLast updated
Was this helpful?