Control Your Kubernetes Costs with KubeCost | Track, Forecast, and Optimize K8s
Key Takeaways
Sets up KubeCost to track, forecast, and optimize Kubernetes costs
Full Transcript
today I'll be showing you how to set up Cube cost on a kubernetes cluster so that you can measure forecast and help control your infrastructure spend on one or more lenoe kubernetes engine clusters this tutorial is designed so you can follow along easily try all this out yourself it's really just a few steps and it can make a huge difference in how much money you spend in your production kubernetes deployments I'm David developer Advocate working for aamai you might know me as tutorial Linux on YouTube if you do I'm sorry as spent a lot of time on the infrastructure side as an infrastructure engineer platform engineer uh and an SRE and one thing I've seen many times is infrastructure costs Cloud costs getting out of control one of the great Promises of the cloud and of Technologies like kubernetes in particular is that they help you centralize and aggregate resources and thereby lower costs but actually getting to the lowering your costs portion takes a little bit of work this is where tools like Cube cost and a lot of the other tools discussed in the linked article or tutorial uh can really help now that you know why we're doing this let's get started by the way I really encourage you to follow along and if you're new to cloud computing or just new to our platform there's a link in the description to get a $100 60-day credit when you sign up so click that link and sign up to follow along with this tutorial let's get to it so first just a few prerequisites the first thing you'll need is the locally installed programs that you'll need to interact with a kubernetes cluster running anywhere and that's Cube cuddle and Helm in the article there are instructions for installing that so just install that however it's appropriate for whatever OS and platform you're running on the second thing you'll need is well you guessed it a kubernetes cluster I'm using a Lode kubernetes engine or LK cluster and you can see in this shot here that I've got that set up and running and you can see the individual VMS are green and everything is rolling from there you'll want to download that Cube config yaml file it might be named for your cluster name as it is in my case let's take a look at that file on our file system this one's in my downloads directory and we're going to come back to those permissions in a second first we're going to export the cube config environment variable and point it at that file so that we can pass this as part of the config when we install Cube cost speaking of those file permissions um they're they're not wrong but we're going to tighten them up a little bit to prevent any warnings from Cube cuddle when we actually use it so we're going to chod change the file mode to 600 which means the user that owns the file can read and write it others from that user's group can't do anything with it and anyone else on the system can't do anything with it either so that'll kind of fix up the permissions for us and you'll be good to go next we're going to register with Cube cost on their website so that we can get an API key to use with the Cube cost software the link is in the tutorial and when you click through the first time it'll prompt you to sign up with an email address you can use your work email address if you're doing this for a work project and you'll be immediately redirected to the dashboard that shows you your Cube cost token in fact it shows you the exact Helm command you need to run to get this installed when you run that Helm command including your unique Cube cost API key in there it'll start a deployment on your LK kubernetes cluster and I wanted to quickly show you an error that can happen if you are rolling through this tutorial too quickly which is if that deployment is still running then the port forwarding command won't work it'll throw an error because the app hasn't finished deploying it so these two troubleshooting commands you see me using which is checking the node State and then checking this deployment state are the two that you might want to run uh if this doesn't work right away but trust that the deployment will work and then run your port forwarding command and what this is going to do is map this application the port that this application is listening on on your kubernetes cluster to your local host and that means you can crack open a new browser window or Tab and go to Local Host 9090 and find the Cube cost dashboard now when you first start it'll be initializing it'll take just a few minutes uh to gather data from your cluster obviously if you have more stuff running it might take just a tiny bit longer and I'm going to cut to when this is complete okay it's done yay uh as before the the data is not super interesting here because this is a demo cluster but you can see actually a bunch of kind of interesting screenshots on their website of this running on like larger much more realistic clusters that have lots of applications running on them and you can start to see where this is going to start saving you a lot of money but even on a demo cluster I actually find this kind of interesting there's there's a lot of data here and you can kind of see what it's looking at it's you can even add multiple that is multiple kubernetes clusters to this couple of final notes now there are alternatives to Cube cost that you can be using that you may have heard of and those are discussed in the aamai article so I do recommend that you check that out and look at some of the discussion to see is anything a better fit for you long term if you're going to run this you're also going to want to make sure to update and upgrade the Cube cost application and thankfully there are instructions on how to do that on the Cube cost website if you scroll down you'll see it right there in the page that you see when you're logged in on the dashboard that's it if you followed along you just set up Cube cost on your LK kubernets cluster and you're probably already seeing where you can save a little bit of money and if you're still not sure whether or not to try this out there's no risk click the link in the description and you get a $100 60-day credit when you sign up I hope this has been useful for you and I hope it's gotten you started with C cost thanks [Music]
Original Description
In this video, @tutoriaLinux shows how to set up Kubecost on a Kubernetes cluster in order to measure, forecast and help control infrastructure spend on The Linode Kubernetes Engine.
New to Cloud Computing? Get started here with a $100 credit → https://www.linode.com/lp/youtube-viewers/?utm_source=youtube&utm_medium=dev_advocacy&utm_content=kubcst_dc_10_23_24
Chapters:
0:00 - Introduction
1:18 - Prerequisites
1:57 - Download Kubeconfig file
2:13 - Export the Kubeconfig environment variable
2:26 - File Permissions
2:53 - Register with Kubecost
3:16 - Run helm command
3:45 - Troubleshooting commands
4:00 - Run port forwarding command
4:13 - Kubecost dashboard
5:02 - Final notes
5:17 - Update & upgrade the Kubecost application
5:36 - Conclusion
Read the doc for more information on installing and configuring Kubecost → https://www.linode.com/docs/guides/controlling-linode-lke-costs-using-kubecost/#installing-and-configuring-kubecost
Learn more about KubeCost → https://www.kubecost.com/
Subscribe to get notified of new episodes as they come out → https://www.youtube.com/channel/UCf8uu3IE42b6hRUusufEH8g?sub_confirmation=1
#AkamaiDeveloper #KubeCost #Kubernetes
Product: Akamai, Kubecost; @tutoriaLinux
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
More on: Kubernetes
View skill →Related Reads
📰
📰
📰
📰
Your HIPAA Posture, in Version Control
Medium · DevOps
hermes-memory-installer: Avoiding Stale Commit Hashes in Consistency Notes
Dev.to AI
Every AWS project starts with copy-pasting last repo's Terraform. I built a generator instead.
Dev.to · Framz
Kubernetes Health Probes: Liveness, Readiness, and Startup Explained
Dev.to · toothbrush
Chapters (13)
Introduction
1:18
Prerequisites
1:57
Download Kubeconfig file
2:13
Export the Kubeconfig environment variable
2:26
File Permissions
2:53
Register with Kubecost
3:16
Run helm command
3:45
Troubleshooting commands
4:00
Run port forwarding command
4:13
Kubecost dashboard
5:02
Final notes
5:17
Update & upgrade the Kubecost application
5:36
Conclusion
🎓
Tutor Explanation
DeepCamp AI