SPEAKER: The best way to maximize cost optimization
for Google Kubernetes Engine is to make sure your app
and GKE are configured for each other.
Today, we'll talk about some tips and best practices
for configuring GKE to work with your app,
and we'll wrap up our cost optimization journey.
Let's go beyond your GKE bill.
[MUSIC PLAYING]
The last video went over some tips for configuring your app.
And the videos before that covered
a lot of best practices.
If you haven't seen the previous videos,
make sure to watch them before you watch this one.
I'll start with some suggestions for batch and serving
workloads.
Then, we'll do some networking, and finally,
wrap up the whole video series and talk about what's next.
As always, knowledge about your application
can help you focus on which cost-optimization techniques
will give you the most impact.
We can simplify most applications
by grouping them into two groups--
batch and serving.
Batch applications have work to do,
but tend to be less concerned about startup time
and usually aren't time-sensitive overall.
Apps like monthly data calculations or low priority
data transformation are great examples of batch jobs.
As these jobs need to be scheduled,
the cluster autoscaler can spin up new nodes,
and then remove them when the job is done.
Even better, node autoprovisioning
works best with batch workloads since it
can figure out optimal resources,
and then create a new node pool, and doesn't need to worry
as much about spikes in demand.
Here's some other tips for working with batch workloads.
The cluster autoscaler can delete empty nodes
faster when it doesn't need to also restart
the pods on those nodes.
Splitting up your applications into dedicated node pools,
using labels and selectors or taints and tolerations,
can help the cluster autoscaler scale quicker
and avoid wasted resources.
There's even an optimize-utilization profile
for the cluster autoscaler that focuses more
on maximizing utilization rather than keeping
spare resources at the ready.
It scales down a lot quicker, which can help aggressively
minimize extra resources.
Also, you can separate different applications
with node auto-provisioning, along with using
taints and tolerations.
Node pools will then be better sized for each application,
once again, optimizing your resource usage.
And don't forget that preemptible VMs are
much cheaper to use, but only if your apps are fault-tolerant
and much less time-sensitive.
Opposite of batch applications are
serving apps, which need the ability to scale rapidly
in response to spikes in demand--
for example, a retail website on major shopping holidays.
In order to handle the sudden increases in demand,
it's good for serving workloads to be
lean and optimized to work best with GKE.
The quicker that pods can start up,
the more efficient autoscalers are at responding to demand.
If you have a serving app that requires resources
with a long provisioning time, like, GPUs,
it makes sense to overprovision and have
resources at the ready before the demand spikes.
Plus, you can use pause pods to help you scale ahead.
We went over some ways to overprovision
and to keep your apps lean in the previous videos.
Optimizing both of those will give you
the most cost-efficient way to handle high-demand spikes.
Here's another best practice for GKE.
Make sure to use NodeLocal DNSCaching.
If you're running a version with kube-dns,
apps that make a lot of DNS lookups
will put extra pressure on it.
While the kube-dns autoscaler will
create more kube-dns replicas, it
takes time to add those replicas and increases resource usage.
Instead of just increasing the kube-dns replicas
in your configuration, add the NodeLocal DNSCache add-on.
Each node will then store a DNS cache,
which helps kube-dns require less resources
and saves overall time for lookups.
On top of that, round-trip request time is usually better
when it's low.
One tip for lowering this is to use container-native load
balancing.
Rather than sending requests to instance groups and then pods,
container-native load balancing allows requests to go directly
to the pod by creating what's called a Network Endpoint
Group.
When these are configured, GKE Ingress
will handle the creation of the L7 load
balancer, along with forwarding rules, health
checks, firewalls, and more.
One quick tip for you-- if you do container-native load
balancing, you'll want to start failing your readiness probe
as soon as you receive a SIGTERM, which
we talked a little bit about in the last video.
That way the load balancers will know
to stop forwarding new requests to your app.
Not only does container-native load balancing
provide improved load balancing and more efficient autoscaling,
it can also enable you to use other tools, like,
Traffic Director, and other Google Cloud services.
All right, I know this was a ton of information to absorb.
You can always reference these videos
and the full best practices guide, which
will be kept up to date as new versions and tips are
available.
Plus, those tips lead right to the documentation
for steps on how to implement them.
Let's do a quick summary and checklist.
Start with the culture and move the cost discussion
to the left.
Help teams understand how their work affects cost,
even if you've built an abstraction layer between teams
and their clusters.
Try creating programs, like, online classes
to help raise familiarity and create
cost-optimization awareness.
Use monitoring to better understand
how applications use resources, and then
implement quotas, requests, and limits,
that make sense for your apps, while also minimizing
any wasted costs.
From machine families to preemptibles,
you can optimize your infrastructure
to improve performance and save money.
Don't forget about committed use discounts, too.
The cloud's dynamic resources help
make autoscaling an efficient strategy.
But configuring it correctly for your applications
is vital to handling spikes in demand,
while also balancing performance with cost.
Make sure that you spend time to increase your application's
compatibility with Kubernetes and configuring
GKE for your application for the best results.
Cost optimization is all about increasing the business value
for what you get out of what you're spending on the cloud.
Saving costs can be a part of that,
but these tips are more about getting
the most return out of costs and optimizing your usage.
We've covered a wide range of things
to consider when building, scaling, and deploying on GKE.
Make sure to check out the full best practices
guide for more details.
And thank you for watching.
[MUSIC PLAYING]