Goldilocks is an open-source tool by Fairwinds. Goldilocks is a utility that can help us to identify a starting point for resource requests and limits. It is a Kubernetes controller that provides a dashboard that gives recommendations on how to set your resource requests. Goldilocks doesn't recommend resource requests/limits by itself. It utilizes a Kubernetes project called Vertical Pod Autoscaler (VPA).
2. Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
Punctuality
Join the session 5 minutes prior to
the session start time. We start on
time and conclude on time!
Feedback
Make sure to submit a constructive
feedback for all sessions as it is
very helpful for the presenter.
Silent Mode
Keep your mobile devices in silent
mode, feel free to move out of
session in case you need to attend
an urgent call.
Avoid Disturbance
Avoid unwanted chit chat during
the session.
4. Introduction
Goldilocks is an open source tool that recommends the right settings for resource requests and limits on kubernetes workloads.
Goldilocks is a Kubernetes controller that provides a dashboard that gives recommendations on how to set your resource
requests.Goldilocks is a utility that can help you identify a starting point for resource requests and limits.
5. Features
1. Recommends values for resource requests and limits on kubernetes workloads.
2. Dashboard that shows recommended values for kubernetes resources based on QoS(Quality of Service).
3. The controller watches Kubernetes events for Deployments and Namespaces that have been modified, created, or
deleted.
4. CLI utility for analysis of kubernetes deployment resource usage.
6. Components
Labelling
Right now, goldilocks labels all VPA objects that are created with two unique labels. These are used to keep track
of the objects that it creates.In addition, namespace labels are utilized. The label
goldilocks.fairwinds.com/enabled=true is used to signify that the deployments in a namespace should be given
VPAs.
Controller
The controller watches Kubernetes events for Deployments and Namespaces that have been modified, created,
or deleted. When one of these is changed, the namespace that is involved is "reconciled". This means checking
to see if the namespace is labelled for goldilocks usage and then making sure there is a VPA object for every
deployment in that namespace. All VPA objects are set in recommendation mode only.
7. CLI
The cli has three main features:
1. It can create VPA objects in a namespace for each deployment in that namespace.
2. It can delete all the VPA objects that it created in a namespace.
3. It can provide a JSON summary of all the existing resource limits/requests, and VPA
recommendations.
Dashboard
The dashboard that gives recommendations on how to set your resource requests. And it also
provides a visualization of the VPA recommendations.
Components
8. QoS Class
Quality of Service (QoS) Class refers to different ways of setting your resource requests and limits.
Whenever Kubernetes creates a Pod it assigns one of these QoS classes to the Pod:
1. Guaranteed - In this class, you set your resource requests and limits to exactly the same values which guarantees that
the resources requested by the container will be available to it when it gets scheduled.
2. Burstable - This means that your resource requests are lower than your limits. Essentially, the scheduler will use the
request to place the pod on a node, but then the pod can use more resources up to the limit before it’s killed or throttled.
3. BestEffort - You don’t set any resource requests or limits.
9. Cost Related To Kubernetes
Workload
EKS: The cost of the managed control plane
Managed Kubernetes Provider cost to run one cluster on AWS EKS are $0.10 x 24 x 365 = $876
For all these offerings, there are no automatic version updates or auto-recovery and we still need to pay for the computing
resources like CPU, memory, and ephemeral storage that your worker pods consume.
Cost of the worker nodes
The cost of worker nodes also varies across cloud service providers and depends on the amount of computing resources
you need as well as in which region of the world your servers are running.
Provider is AWS m6gd.large EC2 instances and resources are 2 vCPUs and 8 GB RAM and the total annual cost is
$0.0904 x 24 x 365 = $792
10. Cost Optimization
4 Ways to Optimize Kubernetes Cost
1. Downsizing Your Clusters
You can reduce costs by decreasing the number and size of your cluster. You might delete a
whole cluster or nodes within a cluster. Visualizing the utilization of Kubernetes resources helps
identify and scale down unallocated resources. Cutting underutilized resources is the easiest
way to cut costs.
2. Rightsizing Your Workloads
While downsizing is a method of reducing unallocated resources, rightsizing involves minimizing
the cost of idle resources. In this case, you might not look for fully unutilized resources. You
would typically look for underutilized resources at the pod level. This approach allows you to
move your workloads and create a more accurate profile of the compute resources required to
run your nodes.
11. 3. Running Kubernetes Nodes on Low-Cost Spot Instances
Spot instances help you save money with Kubernetes, but it is important to determine how well you can implement them
before relying on Spot capacity.
4. Auto Scaling
We can do Auto Scaling with Cluster Autoscaler, HPA, and VPA You won’t need to manually track and optimize everything in
Kubernetes, so an automated scaling approach is often the easiest option. An auto scaler lets you decide when to provision
additional resources and when to terminate them. You set the minimum and maximum limits for your resource configurations,
ensuring the system doesn’t accidentally scale up or down too much.
Kubernetes has auto scaling mechanisms that automatically scale entire clusters, pods, or workloads:
● Cluster Autoscaler
● Horizontal Pod Autoscaler (HPA)
● Vertical Pod Autoscalers (VPA)
Cost Optimization
12. Vertical Pod Autoscaler (VPA)
Vertical Pod Autoscaler (VPA) is an autoscaler that enables automatic CPU and memory request
and limit adjustments based on historical resource usage measurements.It increases and
decreases container CPU and memory resource configuration to align cluster resource allotment
with actual usage.
With VPA, there are two different types of resource configurations that we can manage on each
container of a pod:
1. Requests
2. Limits
Components of VPA
1. The VPA Recommender
2. The VPA Updater
3. The VPA Admission Controller
14. VPA Recommender
The Recommender looks at the metric history, OOM events and the
VPA spec of a deployment and suggests fitting values for requests.
The limits raised/lowered based on the limits:requests (more further
down) proportion defined. Hence the Recommender could just be
used by itself if one is unsure what the application actually needs.