Engineering

Monitor DigitalOcean Kubernetes Service with Axiom

06 May 2021

What is DigitalOcean Kubernetes Service?

DigitalOcean Kubernetes (DOKS) is a managed Kubernetes service that lets you deploy Kubernetes clusters without the complexities of handling the control plane and containerized infrastructure

Prerequisites

  • DigitalOcean account
  • Kubectl installed and configured
  • DigitalOcean CLI installed
  • Axiom Deployment

In this tutorial, I will show you how to:

  • Create a Kubernetes Cluster on DigitalOcean
  • Ingress logs from DigitalOcean Kubernetes Service to Axiom
  • Create a dataset & Ingest token on Axiom.
  • Analyze and Stream your Kubernetes logs on Axiom.

Axiom centralizes all your logs from all your log sources, so you have complete visibility into your entire system. Using Axiom for log management means that you can monitor your event logs more effectively and gain deeper insight into your system metrics.

Let's jump in ūüíę

1. Create your account on DigitalOcean, and enter your details.

2. Select Kubernetes in the dashboard menu/control plane, select the Kubernetes version you want to work with (the latest version is selected by default), and choose the data center region you want to create your cluster in.

3. Customize the default node pool, you can choose the names you want to use for your node pool, select the machine type and node plan you want to work with for your cluster capacity, you can create more add additional node pool.

4. Name the cluster, add a tag if you want to, and select the project you want your cluster to belong to.

5. Click Create Cluster and follow the Getting Started steps to Provision your cluster. Setting up the cluster takes some time.

6. Download the cluster configuration file by clicking Actions, then Download Configuration from the cluster home page.

7. Create a token, Click the API link in the main navigation, which takes you to the Applications & API page on the Tokens/Keys tab. In the Personal access tokens section, click the Generate New Token button.

8. Authenticate your DigitalOcean Account to use the doctl
CLI by typing doctl auth init
in your terminal, then paste the token you generated from the control plane in step 7.

 

9. Get the Kubernetes cluster list by typing doctl kubernetes cluster list on your terminal and.

10. Save your cluster credentials using doctl kubernetes cluster kubeconfig save <cluster name> 

11. Confirm to be sure that your current context is the same as the cluster you created.

  • Run kubectl config get-contexts to see the clusters you set-up
  • kubectl config current-contexts tells you which cluster is your active
  • kubectl config use-context [name] lets you switch to a different one.
  • You can see the different nodes name and status on your terminal by running kubectl get nodes

12. Head over to Axiom, Head to Settings ‚Üí Datasets and create a new dataset for your DKS logs.

13. Create an ingest token on the Axiom UI, to create an ingest token.

  • On the Axiom UI, Click on settings, select¬†ingest token.
  • Select¬†Add ingest token.
  • Enter a¬†name¬†and¬†description¬†and select¬†ADD.
  • Copy the generated token to your clipboard. Once you navigate from the page, the token can be seen again by selecting¬†Ingest Tokens.

14. Axiom uses Filebeats to forward logs from your Kubernetes cluster. Setting it up is as simple as copying the daemonset’s yaml file from the Axiom Docs and configuring it by adding the environment variable values for your Axiom host, dataset, and the ingest token.

15. Apply and run your.yaml file using kubectl apply -f (NAME OF FILE).yaml.

  • The Filebeats nodes will be created and you should see them running on the DigitalOcean cloud portal.

16. Back in Axiom, you will see your logs from DOKS been ingested live to the dataset you created earlier.

  • You can now collect and store insights on your logs and run aggregations across all the matching data to generate visualization as well as a table of results.

17. You can also stream your logs on Axiom, this allows you to inspect individual events from DigitalOcean Kubernetes Service and watch as they are ingested live.

That‚Äôs a Wrap ūüé¨

You can now see how direct it is for you to ingress logs from DigitalOcean Kubernetes Service to Axiom. You can read more about Axiom Kubernetes configuration on our docs.

If you have specific questions or issues configuring the file, I’d love to hear about them. Contact us here or ask a question in the Axiom Community!

We do love discussing logging, observability, analytics if you have any thoughts, questions, or suggestions kindly contact us. You can also follow us on Twitter and on our blog. And if you’ve enjoyed this post, please, take a second to share it on Twitter.

Further reading

More about the author

Tola Ore-Aruwaji

Developer Relations Engineer

I am passionate about communicating and simplifying technical concepts for everyone and also enjoy contributing to and building open-source projects.  I am a big advocate for building open and inclusive...

More articles like this