MARK MIRCHANDANI: Cost optimization
is about more than saving money.
It's about maximizing the return on what you're spending.
Let's walk through how to optimize your costs for Google
Kubernetes Engine, or GKE.
Today, we'll be talking about some general tips
for getting started with cost optimization and some best
practices.
In other words, let's go beyond your GKE bill.
[MUSIC PLAYING]
Individuals and companies alike are talking about,
experimenting with, and deploying apps on Kubernetes.
And of course, GKE is made to scale
as you add more traffic and more applications.
However, scaling your apps might also mean scaling your costs.
And as more teams in your organization use Kubernetes,
it may become more complex to manage.
Let's look at some ways to think about how
you can optimize your usage, and your costs, for GKE.
I'll get started by quickly going over some basics,
and then talk about the business and culture side.
Then, I'll go over some general technical tips.
Simply put, what you're paying for with GKE
itself is primarily two things--
the managed architecture for actually running the Kubernetes
cluster, and the resources that your apps are running on,
such as CPUs, memory, and storage.
There's also a few other things that
will affect your costs, like networking and resource
location.
We'll dive into details to better understand and optimize
different areas in these videos.
But no matter what the costs are,
it's hard to make decisions without knowing
where they're coming from.
Being able to have visibility into all the different moving
pieces is incredibly important.
And a great place to start might be
using a dashboard to help visualize your resources.
The next videos will go over some tips
for exactly how to do that.
But try to always remember that the more you understand
about the full details of your applications,
the more opportunities you'll have to optimize.
And don't worry.
You'll hear me say that plenty of times.
On top of that, you shouldn't forget
about the people that are actually
writing the applications.
When you're in a rush to deploy an application, sometimes,
shortcuts get taken.
Or maybe your organization has grown so large
that they completely abstract Kubernetes away from the teams,
and then they're not even sure how their apps make it to GKE.
Either way, keeping developers, operators, and everyone else
in the dark about how their applications actually run
might cause more harm than good.
Instead, consider spending the time
to train your technical teams on Kubernetes
best practices, like online classes, code labs,
even videos like this one.
When teams understand and care about the cost
it takes to run their apps, the more those teams
will be able to optimize.
Beyond that, you can also implement guardrails
to protect yourself from updates that might significantly
affect your costs.
There are ways to automatically enforce policies and set up
quotas for resources that we'll also
cover in this video series.
Building a culture of awareness and accountability
is critical to being able to optimize your costs.
Keeping all of that in mind, let's switch over
to some best practices on the technical side.
You can find reference links in the description
if you want to read more about any of these.
So if you're already using GKE, you're
probably aware of your production clusters.
But how many development clusters do you have?
Smaller teams might work well with one cluster per developer.
But you should actually look at multi-tenant clusters
to save on overhead.
By using namespaces and policies to keep resources capped
and isolated, dev teams can have the room to experiment
that won't lead to any surprise bills.
On top of that, there's a few add-ons
that come with GKE clusters that are important for production
environments, but might not be needed for your development
environments.
For each of your smaller clusters,
consider disabling or limiting add-ons
if you're not using them, such as Cloud Logging
and Monitoring, Horizontal Pod Autoscaling, the Kubernetes
Dashboard, and Kube DNS.
Most can be disabled with a one-line command.
These small add-ons can add up.
So the better you understand what your apps need
and the environment around them, the more you can optimize.
Speaking of what your apps need, do you
know what your pod disruption budgets are?
You can set the number of pods or the percentage of pods that
can be taken down when doing voluntary disruptions,
like upgrades or autoscaling.
Think about the minimum amount of pots
that you need to run without disrupting your applications'
users.
And think about that for each application independently.
Pod disruption budgets can help keep your apps
running as you configure autoscaling
without overprovisioning.
We'll talk more about autoscaling soon.
If you're not sure about how to figure out
things like resource utilization or pod disruption budgets,
stay tuned.
On the next video, we'll talk all
about monitoring your GKE environment
and getting better observability.
Remember to check out the link in the description
for the full guide on GKE cost optimization.
[MUSIC PLAYING]