Upgrade to Pro — share decks privately, control downloads, hide ads and more …

KubeCon-HealthChecks-pdf.pdf

Michelle Noorali
March 11, 2016
490

 KubeCon-HealthChecks-pdf.pdf

Michelle Noorali

March 11, 2016
Tweet

Transcript

  1. Helm • Kubernetes Package Manager • Packages = “Charts” •

    “Homebrew” for Kubernetes • Great way to find, share, and use software built for Kubernetes • Community focused • www.helm.sh
  2. • /healthcheck or /healthz endpoint • checked by external system

    at intervals • On success, do nothing • On failure, notify and heal Health checks continued …
  3. Pre-requisites • Running Kubernetes cluster on GCE [Google Compute Engine]

    • Docker Image for app stored on DockerHub • DockerHub = place to store images • Can also use Quay.io or GCR [Google Container Registry]
  4. Life of Puffy: It’s Alive • Create a pod definition

    in manifest • Create resource in kubernetes from manifest with 
 $ kubectl create -f puffy-pod.yaml • Watch it come to life with $ kubectl get pods -w • Talk to a route • curl pod_ip:port/index on a node • https://asciinema.org/a/7okfmusa0c368obqxba8t9my4
  5. Wait. What is this probe thing? • a probe =

    a diagnostic periodically performed on a container • Three ways to perform a diagnostic: • Execute a command in a container • Successful if exit status code 0 • Perform tcp check on a container’s IP address on a specific port • Successful if the port is open • Perform an HTTP Get against the container’s IP address on a specific port • Successful if response has status code >= 200 and <400
  6. Back to the probes… • Readiness Probe • Is my

    app ready to serve traffic? • On failure, it stops serving requests • Liveness Probe • Is my app in a good state? • On failure, it restarts the pod
  7. Apply the Changes in the Pod Manifest to the Cluster

    $ kubectl delete -f puffy-pod.yaml ~ edit puffy-pod.yaml ~ $ kubectl create -f pod-puffy.yaml
  8. Add /healthz • Define /healthz in app (common convention) •

    Re-build/re-tag image • Push image to registry • Edit image declaration in manifest
  9. Bring Puffy Back! $ kubectl create -f puffy-pod.yaml 
 or

    $ helm install puffy $ kubectl get pods $ kubectl describe pod puffy On node, curl ip:port/healthz
  10. $ helm repo add michelle https://github.com/michelleN/many-directions $ helm repo list

    $ helm search many-directions $ helm install many-directions
  11. Things to watch out for • Try to leave health

    checks as simple as possible • Don’t get too aggressive • Use the right probe for your situation
  12. Summary • Automate monitoring apps with health checks • Use

    Kubernetes’s built in health check features • readinessProbe • Is your app ready to serve traffic? • livenessProbe • Is your app in a good state?
  13. Deployment Manager + Coming together to bring you a simple

    and powerful way to deploy and manage Kubernetes Charts and is going to CNCF along with the rest of Kubernetes
  14. That’s it folks. Thank you. Puffy: www.github.com/michelleN/puffy Many-directions: www.github.com/michelleN/many-directions My

    charts: www.github.com/michelleN/charts Helm: www.helm.sh Helm charts: www.github.com/helm/charts Look for www.github.com/kubernetes/helm & www.github.com/kubernetes/charts @michellenoorali