Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Kubernetes, Second Edition - Second Edition

You're reading from  Getting Started with Kubernetes, Second Edition - Second Edition

Product type Book
Published in May 2017
Publisher Packt
ISBN-13 9781787283367
Pages 286 pages
Edition 2nd Edition
Languages
Author (1):
Jonathan Baier Jonathan Baier
Profile icon Jonathan Baier

Table of Contents (20) Chapters

Title Page
Credits
About the Author
Acknowledgement
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. Introduction to Kubernetes 2. Pods, Services, Replication Controllers, and Labels 3. Networking, Load Balancers, and Ingress 4. Updates, Gradual Rollouts, and Autoscaling 5. Deployments, Jobs, and DaemonSets 6. Storage and Running Stateful Applications 7. Continuous Delivery 8. Monitoring and Logging 9. Cluster Federation 10. Container Security 11. Extending Kubernetes with OCP, CoreOS, and Tectonic 12. Towards Production Ready

Health checks


Kubernetes provides two layers of health checking. First, in the form of HTTP or TCP checks, K8s can attempt to connect to a particular endpoint and give a status of healthy on a successful connection. Second, application-specific health checks can be performed using command-line scripts.

Let's take a look at a few health checks in action. First, we'll create a new controller with a health check:

apiVersion: v1 
kind: ReplicationController 
metadata: 
  name: node-js 
  labels: 
    name: node-js 
spec: 
  replicas: 3 
  selector: 
    name: node-js 
  template: 
    metadata: 
      labels: 
        name: node-js 
    spec: 
      containers: 
      - name: node-js 
        image: jonbaier/node-express-info:latest 
        ports: 
        - containerPort: 80 
        livenessProbe: 
          # An HTTP health check  
          httpGet: 
            path: /status/ 
            port: 80 
          initialDelaySeconds: 30 
          timeoutSeconds: 1

Listing 2-7: nodejs-health-controller...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $19.99/month. Cancel anytime}