May 6, 2021

#engineering

Monitor DigitalOcean Kubernetes Service with Axiom


Blog Screenshot
Author
Tola Ore-Aruwaji

Developer Relations Engineer

What is DigitalOcean Kubernetes Service?

Kubernetes is an open-source orchestration platform to run containers at scale. 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. With the DigitalOcean Kubernetes platform, you can create multiple worker nodes to handle multiple pods on your app platform, which are containers clustered together as a working unit.

DigitalOcean Kubernetes service offers the combined benefits of working with your DigitalOcean app, application logs, and endpoint, meaning that any applications that run on native Kubernetes will run on DigitalOcean Kubernetes without modifications.

Monitoring your DigitalOcean cluster is very important for ensuring that the applications like apache, app platform, syslog, and DigitalOcean spaces, running on it are performing properly. With Axiom capabilities, you can also surface runtime bottlenecks, firewall errors, log data hiccups, and reveal whether your cluster has an adequate app platform capacity for launching new DigitalOcean applications or scaling up existing resources when necessary.

Prerequisites

  • DigitalOcean account
  • Kubectl installed and configured
  • DigitalOcean CLI or doctl installed in your local machine
  • 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.
  • Install the doctl CLI on your DigitalOcean app
  • Analyze and Stream your Kubernetes logs on Axiom.

Axiom centralizes all your logs from all your log sources, giving you complete visibility into your entire system. Using Axiom for log management means that you can monitor your event logs, scale your pods in your log files, scale your docker resources in your applications, and effectively and gain deeper insight into your system error.log metrics.

DigitalOcean Kubernetes is a managed Kubernetes service that lets you deploy clusters. Discover how Axiom can help you monitor event logs effectively.

Monitor DigitalOcean Kubernetes Service with Axiom

  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.

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

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

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

  1. Download the DigitalOcean Kubernetes cluster configuration file by clicking Actions, then Download Configuration from the cluster home page.

  1. 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. In the bar menu, you can also see the Kubernetes pricing for your resources.

  1. 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.

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

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

  3. 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
  1. Head over to Axiom, Head to Settings → Datasets and create a new dataset for your DKS logs.

  1. 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.

  1. 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.
env:
	- name: AXIOM_HOST
	  value: https://app.axiom.co // replace with your self-host url if needed
	- name: AXIOM_DATASET_NAME
	  value: aks-logs
	- name: AXIOM_INGEST_TOKEN
	  value: xait-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  1. 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.

  1. 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.

  1. 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 DigitalOcean 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 our Discord 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

Share
Get started with Axiom

Learn how to start ingesting, streaming, and
querying data into Axiom in less than 10 minutes.