0
0
Kubernetesdevops~20 mins

Cost optimization in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kubernetes Cost Optimization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Kubernetes Resource Requests and Limits

Which statement best explains how setting resource requests and limits in Kubernetes helps optimize costs?

ARequests and limits automatically scale the number of nodes in the cluster to match pod demand, reducing idle nodes.
BRequests reserve resources for pods, ensuring they get guaranteed CPU and memory, preventing overcommitment and reducing wasted resources.
CLimits allow pods to use unlimited resources, which helps avoid throttling and improves performance at no extra cost.
DSetting requests and limits disables autoscaling, which saves costs by fixing resource usage.
Attempts:
2 left
💡 Hint

Think about how reserving resources affects scheduling and cluster utilization.

💻 Command Output
intermediate
2:00remaining
Identifying Idle Nodes with kubectl

You run the command kubectl top nodes and see the following output:

NAME           CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
node-1         50m          5%     200Mi          10%
node-2         10m          1%     100Mi          5%
node-3         300m         30%    1Gi            50%

Which node is the best candidate for scaling down to save costs?

Anode-2 because it has the lowest CPU and memory usage.
Bnode-3 because it uses the most CPU and memory.
Cnode-1 because it has moderate CPU and memory usage.
DNone, all nodes are equally used.
Attempts:
2 left
💡 Hint

Look for the node with the least resource usage to identify idle nodes.

🔀 Workflow
advanced
2:00remaining
Implementing Cluster Autoscaler for Cost Savings

You want to enable automatic scaling of your Kubernetes cluster nodes to save costs during low demand periods. Which configuration step is essential to allow the Cluster Autoscaler to remove nodes safely?

AManually delete pods before the autoscaler removes nodes.
BDisable resource requests and limits on all pods to allow flexible scheduling.
CSet pod disruption budgets to ensure critical pods are not evicted during node scale-down.
DSet all nodes to unschedulable to prevent new pods from being scheduled.
Attempts:
2 left
💡 Hint

Think about how to protect important pods during node removal.

Troubleshoot
advanced
2:00remaining
Troubleshooting High Costs Due to Overprovisioning

Your Kubernetes cluster costs are unexpectedly high. You suspect overprovisioning. Which of the following is the most likely cause?

AHorizontal Pod Autoscaler is scaling pods based on CPU usage.
BPods have no resource requests or limits, so the scheduler packs them tightly on nodes.
CCluster Autoscaler is enabled and removing unused nodes automatically.
DPods have resource requests set too high, causing the scheduler to reserve more node capacity than needed.
Attempts:
2 left
💡 Hint

Consider how resource requests affect node allocation.

Best Practice
expert
3:00remaining
Choosing the Best Strategy for Cost Optimization

Which strategy provides the most effective cost optimization in a Kubernetes environment running variable workloads?

AUse Cluster Autoscaler with right-sized resource requests and limits, combined with Horizontal Pod Autoscaler for workload scaling.
BSet fixed large resource requests for all pods to avoid scheduling delays and keep nodes fully utilized.
CDisable autoscaling and manually add nodes during peak hours to control costs.
DRun all workloads on a single large node to minimize node count.
Attempts:
2 left
💡 Hint

Think about combining multiple scaling mechanisms and resource management.