Skip to content

Content from my "Monitoring Kubernetes: The Sidecar Pattern" webinar for CNCF (August 13, 2019)

Notifications You must be signed in to change notification settings

calebhailey/monitoring-k8s-workloads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Monitoring Kubernetes: The sidecar pattern

This repository contains content from my August 8, 2019 webinar for the [Cloud Native Computing Foundation][cncf], entitled "Monitoring Kubernetes: The sidecar pattern".

Prerequisites

  1. A Kubernetes cluster

Overview

  1. Deploy Sensu.

    Coming soon...

  2. Deploy an example application as a Kubernetes deployment (NGINX website).

    The NGINX deployment in kubernetes/nginx-deployment.yaml is a very simple example K8s service + deployment. Let's deploy it using kubectl apply:

    $ kubectl create namespace webinar
    $ kubectl --namespace webinar apply -f kubernetes/nginx-deployment.yaml
    $ kubectl --namespace webinar get services
    NAME    TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)          AGE
    nginx   LoadBalancer   10.27.251.183   35.230.122.31   8000:30161/TCP   33d
    

    Visit your example application in your browser by visiting the "EXTERNAL-IP" address. For example, the Kubernetes service shown above is accessible at http://35.230.122.31:8000

  3. Add the Sensu Go agent as a sidecar for your example application.

    The NGINX deployment in kubernetes/nginx-deployment-with-sensu-sidecar.yaml shows how easy it is to add the Sensu Go agent as a sidecar. Let's updated our deployment using kubectl apply:

    $ kubectl --namespace webinar apply -f kubernetes/nginx-deployment-with-sensu-sidecar.yaml

    If you visit your Sensu dashboard in your browser, you will see that our sidecars have already registered themselves with Sensu.

    How does it work? Here's the relevant excerpt from the spec.template.spec.containers scope in the Kubernetes deployment manifest:

    - name: sensu-agent
      image: sensu/sensu:5.11.1
      command: ["/opt/sensu/bin/sensu-agent", "start", "--log-level=debug", "--insecure-skip-tls-verify", "--keepalive-interval=5", "--keepalive-timeout=10"]
      env:
      - name: SENSU_BACKEND_URL
        value: wss://sensu-backend-0.sensu.sensu-system.svc.cluster.local:8081 wss://sensu-backend-1.sensu.sensu-system.svc.cluster.local:8081 wss://sensu-backend-2.sensu.sensu-system.svc.cluster.local:8081
      - name: SENSU_NAMESPACE
        value: webinar
      - name: SENSU_SUBSCRIPTIONS
        value: linux kubernetes nginx
      - name: SENSU_DEREGISTER
        value: "true"
      - name: SENSU_STATSD_EVENT_HANDLERS
        value: statsd
  4. Configure the monitoring check.

    $ sensuctl --namespace webinar create -f sensu/checks/check-nginx.yaml
  5. Configure the telemetry pipeline (InfluxDB Handler).

    $ sensuctl --namespace webinar create -f sensu/handlers/influxdb.yaml

About

Content from my "Monitoring Kubernetes: The Sidecar Pattern" webinar for CNCF (August 13, 2019)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published