The Nautilus DevOps team has noticed performance issues in some Kubernetes-hosted applications due to resource constraints. To address this, they plan to set limits on resource utilization. Here are the details:
Create a pod named httpd-pod
with a container named httpd-container
. Use the httpd
image with the latest
tag (specify as httpd:latest
). Set the following resource limits:
Requests: Memory: 15Mi
, CPU: 100m
Limits: Memory: 20Mi
, CPU: 100m
Note:
The kubectl
utility on jump_host
is configured to operate with the Kubernetes cluster.
apiVersion: v1
kind: Pod
metadata:
name: httpd-pod
spec:
containers:
- name: httpd-container
image: httpd:latest
resources:
requests:
memory: "15Mi"
cpu: "100m"
limits:
memory: "20Mi"
cpu: "100m"
# Apply the yaml conf file
kubectl apply -f httpd-pod.yaml
pod/httpd-pod created
# Verify that the pod is running
kubectl get pod httpd-pod
NAME READY STATUS RESTARTS AGE
httpd-pod 1/1 Running 0 27s
# Verify that CPU and memory requests/limits are set correctly
kubectl describe pod httpd-pod | grep -A5 "Limits"
Limits:
cpu: 100m
memory: 20Mi
Requests:
cpu: 100m
memory: 15Mi