Kubernetes in Practice
Minimum price
Suggested price

Kubernetes in Practice

About the Book

Kubernetes is here to stay.

In the beginning, there was the monolith. It was easy to deploy and easy to keep it running, we had only one thing (or a few) to keep an eye on.

But it was not perfect. It was hard to scale individual components, changes in one tiny part of the application required a whole redeployment and the lack of clear boundaries could lead to a design that was not-so-great.

The industry started converging to microservice-based architectures. What was before a single application became dozens of services that could be more easily scaled and deployed individually.

But it was not perfect. Having dozens, hundreds, or thousands of services running reliably is no easy task. It was clear we needed a way to orchestrate these applications and services that are now running in containers. That's where Kubernetes comes into play.

Kubernetes is complex, but getting started should be easier.

You start studying Kubernetes. They start talking about cgroups, pid namespaces and overlay networks and you have no idea why you should care. You just want to learn how to run your applications and what Kubernetes brings to the table.

It doesn't need to be this hard.

Kubernetes is, no doubt, a very complex tool, but it does an amazing job at abstracting that complexity from us so we can start using it and learning about what is really important: How do I run my applications reliably?

We will have plenty of time to get down to the nitty-gritty of Kubernetes, but that shouldn't be the focus when you are starting out.

What you will learn:

This book is practical, we will run applications with Kubernetes from chapter one. You will learn everything you need to know to reliably run your own applications, both locally and with a cloud provider. We will see how to scale our applications, different ways to expose them to the outside world, how to deal with configs and secrets our apps need, handle rollouts with zero downtime and more!

About the Author

Brian Storti
Brian Storti

Hi! I'm Brian (@brianstorti) and I've been writing software professionally since 2007. I currently work as a Principal Infrastructure Engineer at AlphaSights, and was a Senior Consultant at ThoughtWorks before that. I also have a blog.

These days I spend most of my time working with Kubernetes and helping engineering teams.

Table of Contents

  • What Kubernetes brings to the table
  • Preparing your environment
  • Deploying our first application
  • Kubernetes architecture
    • A Kubernetes cluster
    • The workers
    • The master
    • Kubectl, our swiss army knife
    • Recap
  • Pods
    • Introduction
      • Pods are the atomic unit of scheduling
    • Multi-container Pods
    • Playing with running pods
      • Streaming logs
      • Executing commands
      • Killing pods
    • It’s your turn
    • Recap
  • Deployments
    • Introduction
    • Defining our Deployment manifest
    • Restarting failed pods
    • Scaling up our application
      • A note about how containers are scheduled
    • Scaling it down
    • Rolling out releases
    • Controlling the rollout rate
    • Using a different rollout strategy
    • Dealing with bad releases
      • Automatically blocking bad releases
    • Keeping applications healthy with liveness probes
      • Running custom commands for liveness and readiness probes
    • Recap
  • Services
    • Introduction
    • A quick example
    • Service Types
    • ClusterIP
    • NodePort
    • LoadBalancer
    • ExternalName
    • Service Discovery
    • DNS
    • Environment Variables
    • Recap
  • Ingress
    • Introduction
    • Adding an Ingress Controller
    • Ingress in action
    • Defining rules per host
      • Sending the correct Host in our local requests
    • Ingress vs LoadBalancer
    • Recap
  • Configuring applications with ConfigMaps
    • Introduction
    • Changing our sample app
    • Passing an environment variable to our container
    • Extracting configs to a ConfigMap
      • Getting all the variables from a ConfigMap
    • Mounting configs as files
    • Recap
  • Using Secrets for sensitive configs
    • Introduction
      • Using stringData
    • Mounting Secrets as files
    • Environment variables or volume mounts?
    • Recap
  • Running Jobs
    • Introduction
    • Running multiple pods
    • When jobs fail
    • Scheduling Jobs with CronJob
    • Recap
  • Kubernetes Web UI
  • Organizing resources with namespaces
    • Introduction
    • Creating a namespace
    • Running resources in a different namespace
    • How namespaces affect service’s DNS
    • Recap
  • Managing containers resource usage
    • Introduction
    • Checking our allocatable resources
    • Defining resource requests
    • Defining resource limits
    • Differences between memory and CPU limits
    • Defining default limits and requests with LimitRange
    • Recap
  • Understanding the kubeconfig file
    • Introduction
    • The anatomy of kubeconfig
    • The current context
    • Providing a different config file
    • Recap
  • Kubernetes IRL
    • Choosing a cloud provider
    • Creating a cluster
    • Configuring kubectl
    • Deploying an application
    • Exposing our application
    • Using a Load Balancer
      • Deploying nginx
    • Using an Ingress
    • Recap
  • Thank you!

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub