By Evan Hazlett, Open Source Developer,
Kentik
Kubernetes has become the de facto standard
for cloud-based applications. As companies migrate more and more workloads,
ensuring reliable connectivity and performance are critical not just for user
applications but also for the cluster itself. In this article, we will discuss
how augmenting your system monitoring with in-cluster synthetic testing can
give you proactive indicators that something might be headed for trouble.
Synthetics
Synthetic tests provide a way of simulating
real user actions in a variety of ways. They give insight into real-world usage
of your applications and services, whether it be network availability, DNS
resolution, or server response times to name a few.
Kubernetes is intended to streamline
deployment and application management. By design, it enables faster delivery by
hiding the complexity of the underlying infrastructure allowing teams to deploy
using common patterns. This gives teams more control over their application
development and lifecycle but also means the responsibility for ensuring
application health is largely on them. In an ideal scenario, the team would
instrument applications and services to both observe and continuously check
health, but in reality, we know that is not always the case. By giving teams
the ability to integrate synthetic tests directly into their current
development workflow, they can quickly gain insight into how their applications
are performing.
At Kentik, we provide Synthetic
Testing to monitor the digital experience across network
infrastructure, multiple clouds, SaaS applications, and page transaction
testing. We maintain a network of hundreds of agents around the world that
continuously monitor designated targets using a range of tests, including page
response, DNS lookup times, BGP monitoring, and more. We wanted to bring this
same level of synthetic testing to Kubernetes enabling developers to easily add
checks for their applications, so we created Odyssey:
an open source Kubernetes operator for synthetic testing.
Odyssey
Odyssey is an open source Kubernetes operator
that automates agent provisioning and configuration for a synthetic test
framework in a Kubernetes cluster. The operator pattern enables developers to extend
Kubernetes for their own applications and still follow the Kubernetes
principles. When used with Kentik Synthetics, this gives a number of benefits:
- A standard synthetic platform for
all teams
- Operator controlled base framework
- The operator, not the team,
manages cloud provider access
- Developers focus on writing
checks, not managing infrastructure
Once the Odyssey operator is deployed, teams
can leverage their existing Kubernetes knowledge by having a familiar and
simpler method to add synthetic checks to their applications. Let's look at an
example deployment with a service:
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
labels:
app: demo
spec:
replicas: 3
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: demo
image:
docker.io/ehazlett/sysinfo:latest
ports:
- containerPort:
8080
name: app
---
apiVersion: v1
kind: Service
metadata:
name: demo
labels:
app: demo
spec:
selector:
app: demo
ports:
- name: app
port: 8080
targetPort: app
protocol: TCP
In this example, we have a deployment that
exposes a service on port 8080 and a service that provides access to the
deployment also on port 8080. Let's look at adding an Odyssey check to the
application that performs an HTTP GET request on the service.
Odyssey provides a custom resource to define a synthetic task.
This can be a variety of checks including ping and fetch that will ping a host
and perform an HTTP request respectively. In the following example it shows how
to create an HTTP check with the Odyssey fetch task:
apiVersion: synthetics.kentiklabs.com/v1
kind: SyntheticTask
metadata:
name: demo
spec:
fetch:
- service: demo
target: /
port: 8080
method: GET
period: 10s
expiry: 5s
This test will perform an HTTP GET against the
Kubernetes service every ten seconds. The operator takes care of resolving the
service address and backends allowing the developer to only have to define the
application target and not the underlying infrastructure pieces. Once deployed,
the Kentik synthetic agent will be provisioned and configured to run the task.
When paired with the Kentik Synthetic Dashboard, it gives a great view into
both current and historical performance.
With more and more applications moving to
Kubernetes, having an easy way to integrate continuous synthetic testing into
your cluster brings the necessary insight and operational reliability needed
for production services. When coupled with Kentik Synthetics, it gives teams a
complete view of their environment from network to application endpoint.
##
To hear more about cloud native topics, join the Cloud Native Computing Foundation and
the cloud native community at KubeCon + CloudNativeCon North America 2022 in Detroit
(and virtual) from October 24-28.
ABOUT THE AUTHOR
Evan Hazlett, Open Source Developer, Kentik
Evan is a software engineer on the Kentik Labs team. He has a long
tenure in open source with contributions to projects such as Kubernetes,
containerd, and Docker. Evan was previously a core maintainer for Docker and a
member of the containerd team.