Relevant Documentation
Lesson Reference
Create a pod with resource requests that exceed available node resources.
- Create a YAML file named
big-request-pod.yml
and open it for editing:
vi big-request-pod.yml
- Add the following content to the file:
apiVersion: v1 kind: Pod metadata: name: big-request-pod spec: containers: - name: busybox image: busybox command: ['sh', '-c', 'while true; do sleep 3600; done'] resources: requests: cpu: "10000m" memory: "128Mi"
- Save and close the file.
- Create the pod using the YAML file:
kubectl create -f big-request-pod.yml
- Check the status of the pod. It should remain in the Pending state since no worker nodes have enough resources to meet the request:
kubectl get pod big-request-pod
- Create a pod with resource requests and limits.
- Create a YAML file named
resource-pod.yml
and open it for editing:
vi resource-pod.yml
- Add the following content to the file:
apiVersion: v1 kind: Pod metadata: name: resource-pod spec: containers: - name: busybox image: busybox command: ['sh', '-c', 'while true; do sleep 3600; done'] resources: requests: cpu: "250m" memory: "128Mi" limits: cpu: "500m" memory: "256Mi"
- Save and close the file.
- Create the pod using the YAML file:
kubectl create -f resource-pod.yml
- Check the status of the pod:
kubectl get pods