As more and more Kubernetes clusters are deployed within environments, whether it’s for production or testing, engineers need a more efficient way to manage them all from deploying resources to viewing/reading existing resources.
There’s where Headlamp can come into play.
In this blog post, you’ll learn about the new open-source project called Headlamp from Micorosft and how to implement it.2
Prerequisites
To follow along with this article, you’ll want to have one Kubernetes cluster running so you can access it via Headlamp.
Why Headlamp
Managing one Kubernetes is pretty straightforward. Two is fine as well. Three? Maybe getting a little cumbersome… Five? Ten? Twenty? At some point, you don’t want to manage multiple clusters manually in terms of deployments.
The next logical thing to do would be to use a combination of solutions like ArgoCD, packaged up YAML, or perhaps no YAML at all and go towards a solution that removes the need for YAML and gives you the ability to just worry about the code.
You’ll still most likely want something that you can view resources within the cluster. Even from a troubleshooting perspective, you may just want to look at Pod logs quickly or see what resources are deployed in a particular Namespace.
You can use kubectl
or various other solutions, or you can see a GUI-based solution that gives you the ability to see all Kubernetes resources and Worker Nodes running in one place.
Headlamp gives you that “one place”.
When thinking about a solution like Headlamp, it’s a GUI on top of the Kubernetes API. The goal is with something like Headlamp, you no longer have to worry about a bunch of kubectl
commands. It’s very similar to thinking about something like Windows Admin Center. Like Windows Admin Center (which gives you the ability to manage servers in one GUI-centric location), you can manage multiple clusters and resources in one place.
Installation
Installing Headlamp comes in two forms:
- A GUI/UI.
- Inside of the Kubernetes cluster and it runs like any other k8s resource.
For a tool like this, chances are you’re going to use the UI/GUI.
Let’s see how to do both.
Inside Of A Cluster
For the in-cluster installation, you can use Helm, which is the de facto standard for Kubernetes package management.
First, add the repo that contains the resources for Headlamp.
helm repo add headlamp https://headlamp-k8s.github.io/headlamp/
Next, install Headlamp.
helm install my-headlamp headlamp/headlamp --namespace kube-system
If needed, you can update the values.yaml
file just like you can in any other Helm installation.
GUI
With the graphical version of Headlamp, you’ll be able to download it for the Operating System you’re currently running on. For the installation, you can follow this link: https://headlamp.dev/
There’s a command-line method of installation and a package/.exe installation method. Because I’m on a Mac, when I go to the Headlamp website, I see the Mac method.
With the Mac method, you can either use brew (a popular Mac package manager) or a .dmg
, which is the package type on a Mac.
Here’s the package manager installation.
brew install headlamp
Here’s the package-based installation.
After Headlamp is installed, you’ll be able to access it via the Headlamp GUI. It’ll be in your application list on your computer.
Headlamp Configuration
Now that Headlamp is installed, let’s open it and configure it.
Luckily, there isn’t much configuration needed. As you can see from the screenshot below, as soon as you open Headlamp, it’ll see what Kubernetes clusters you have access to and load them in.
The way Headlamp is able to see the Kubernetes clusters you have access to is by scanning the kubeconfig
on your local computer.
The screenshot below is an example of what you’ll see after clicking one of the clusters.
Another way to have Headlamp view your Kubeconfig
is by uploading it directly.
To upload it, click the + ADD CLUSTER button.
Once you do that, you’ll be able to upload your Kubeconfig from your local computer.
Now that your clusters are accessible via Headlamp, you can start to use Headlamp to do things like view current Kubernetes resources or create your own.
Creating Resources
To create resources, click on the cluster where you want to create resources like Pods and then click the + CREATE button.
You’ll see a box pop up where you’ll upload the YAML you want to deploy. In this case, as an example, you can see a Kubernetes Deployment deploying two Ollama Replicas/Pods.
After clicking the blue APPLY button on the bottom right of the screenshot above, you should see a similar output like in the screenshot below.
Congrats! You’ve successfully connected clusters to Headlamp and deployed Pods.
Top comments (0)