Cloud Native Microservices With Kubernetes
$22.99
Minimum price
$27.99
Suggested price

Cloud Native Microservices With Kubernetes

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

About the Book

TL;DR:

In this comprehensive guide, we will dive deep into the intricacies of microservices, high-availability strategies, CI/CD, GitOps, and observability in a Cloud Native world.

We will employ a wide array of tools, including:

  • Docker,
  • Kubernetes,
  • minikube,
  • Rancher,
  • Terraform,
  • Operators,
  • Helm,
  • Prometheus,
  • Istio,
  • Grafana,
  • OpenTelemetry,
  • Jaeger,
  • Loki,
  • Argo CD
  • and more.

These are the top 10 things you will learn in this guide:

  1. Understand the Cloud Native approach to building software and microservices.
  2. Understand Kubernetes architecture and its core components.
  3. Run Kubernetes locally and in the cloud.
  4. Use Rancher to manage containers and Kubernetes.
  5. Manage data persistence in Kubernetes.
  6. Understand the different types of services in Kubernetes and when to use each one.
  7. Use Operators, Helm, Terraform, and other tools to provision and manage Kubernetes clusters.
  8. Implement deployment strategies such as Blue/Green, Canary, and Rolling updates.
  9. Use Istio to implement a service mesh in Kubernetes.
  10. Implement Observability and GitOps in Kubernetes using Prometheus, Grafana, Jaeger, Loki, OpenTelemetry, and Argo CD.

About This Book:

This book will guide you on a thrilling journey, revealing the nuances and potential of Kubernetes, the most popular container orchestration platform in the world. You'll discover how Kubernetes can be leveraged to build a robust, scalable, and resilient microservices architecture.

"Cloud Native Microservices With Kubernetes" is a comprehensive guide that will navigate you through the intricacies of Kubernetes and help you leverage its full potential.

It is designed to cater to a wide audience, from beginners who are making their first foray into Kubernetes to experienced professionals who wish to deepen their understanding of the platform and stay updated with its most recent advances.

The chapters are structured sequentially to facilitate progressive learning. We start by exploring the different options to run Kubernetes locally and in the cloud.

We will see how to use minikube, Rancher, and Terraform to provision a Kubernetes cluster in the cloud, and then we will use a cloud provider's managed Kubernetes service to provision a cluster.

We will also explore the Cloud Native approach to software development and the basic components of Kubernetes before moving on to more complex topics such as resource management, autoscaling, and deploying various types of microservices.

In this comprehensive guide, we will dive deep into the intricacies of microservices, high-availability strategies, CI/CD, and observability in a Cloud Native world.

We will employ a wide array of tools, including Docker, Kubernetes, minikube, Rancher, Terraform, Operators, Helm, Prometheus, Istio, Grafana, OpenTelemetry, Jaeger, Loki, and more.

Our exploration will include GitOps, with a focus on creating an efficient GitOps workflow using Argo CD. We will adeptly handle CI/CD (continuous delivery and deployment) strategies such as Blue/Green, Canary deployments, and Rolling updates.

In addition, we will cover how to expertly manage data in Kubernetes using persistent volumes and stateful sets. We will navigate the creation of various types of services in Kubernetes and how to expose them to the outside world using Ingress and Service Mesh.

The book focuses on achieving high availability, scalability, and efficient deployment, monitoring, CI/CD, and everything else you need to build your next microservices architecture. All of this can be done by leveraging the power of Kubernetes and its ecosystem.

Each chapter of this guide includes examples and practical exercises designed to offer a hands-on experience. By working through these examples, you'll gain a practical understanding of Kubernetes concepts and their application in real-world scenarios.

This book is designed to equip you with the knowledge and skills needed to build, manage, scale, deploy, and monitor your microservices on Kubernetes.

By the end of this book, my goal is for Kubernetes to no longer seem like a daunting labyrinth. Instead, it will be a tool you are proficient in and can use to write your own success story.

Enjoy the journey!

  • Share this book

  • Categories

    • DevOps
    • Docker
    • Distributed Systems
    • Infrastructure as Code
    • Cloud Computing
    • Software Architecture
    • Software Engineering
  • Feedback

    Contact the Author(s)

About the Author

Aymen El Amri  @eon01
Aymen El Amri @eon01

Aymen El Amri is an author, entrepreneur, trainer, and polymath software engineer who has excelled in a range of roles and responsibilities in the field of technology including DevOps & Cloud Native, Cloud Architecture, Python, NLP, Data Science, and more.

Aymen has trained hundreds of software engineers and written multiple books and courses read by thousands of other developers and software engineers.

Aymen El Amri has a practical approach to teaching based on breaking down complex concepts into easy-to-understand language and providing real-world examples that resonate with his audience.

Some projects he founded are FAUN, eralabs.io, and Marketto. You can find Aymen on Twitter and Linkedin.

Aymen El Amri  @eon01

Episode 88

Table of Contents

    • 1 Cloud Native Microservices: How and Why
      • 1.1 Common approaches
      • 1.2 The twelve-factor app
        • 1.2.1 I. Codebase
        • 1.2.2 II. Dependencies
        • 1.2.3 III. Config
        • 1.2.4 IV. Backing services
        • 1.2.5 V. Build, release, run
        • 1.2.6 VI. Processes
        • 1.2.7 VII. Port binding
        • 1.2.8 VIII. Concurrency
        • 1.2.9 IX. Disposability
        • 1.2.10 X. Dev/prod parity
        • 1.2.11 XI. Logs
        • 1.2.12 XII. Admin processes
      • 1.3 Microservices
        • 1.3.1 Database per service
        • 1.3.2 API Composition
        • 1.3.3 Service instance per container
        • 1.3.4 Externalized configuration
        • 1.3.5 Server-side service discovery
        • 1.3.6 Circuit breaker
        • 1.3.7 Cloud native
      • 1.4 From monolith to cloud native microservices
    • 2 Requirements
      • 2.1 A Development server
      • 2.2 Install kubectl
    • 3 Kubernetes: creating a cluster
      • 3.1 Creating a development Kubernetes cluster using minikube
        • 3.1.1 minikube installation
        • 3.1.2 minikube creating a cluster
        • 3.1.3 minikube profiles
        • 3.1.4 K8s dashboard on minikube
        • 3.1.5 Creating a Deployment
        • 3.1.6 Kubernetes events
        • 3.1.7 Exposing a deployment
        • 3.1.8 Deleting K8s resources
        • 3.1.9 minikube addons
        • 3.1.10 Using Kubectl with minikube
        • 3.1.11 Deleting clusters
      • 3.2 Creating a development Kubernetes cluster using Rancher
        • 3.2.1 Requirements
        • 3.2.2 Using Terraform to launch the cluster
        • 3.2.3 Creating Kubernetes resources using Rancher UI
      • 3.3 Creating an on-premises Kubernetes cluster using Rancher
        • 3.3.1 Requirements before starting
        • 3.3.2 Creating a cluster using Rancher server
        • 3.3.3 Notes about high availability
      • 3.4 Creating an on-premises Kubernetes cluster: other options
      • 3.5 Managed clusters
      • 3.6 Creating a managed DOK cluster using Terraform
    • 4 Kubernetes architecture overview
      • 4.1 Introduction
      • 4.2 The Control Plane
        • 4.2.1 etcd
        • 4.2.2 API Server (kube-apiserver)
        • 4.2.3 Controller Manager (kube-controller-manager)
        • 4.2.4 Cloud Controller Manager (cloud-controller-manager)
        • 4.2.5 Scheduler (kube-scheduler)
      • 4.3 Worker nodes
        • 4.3.1 Kubelet
        • 4.3.2 Container Runtime
        • 4.3.3 Kube-proxy
      • 4.4 Node pools
      • 4.5 An overview of the architecture
    • 5 Stateless and stateful microservices
      • 5.1 Introduction
      • 5.2 Stateless workloads
      • 5.3 Stateful workloads
    • 6 Deploying Stateless Microservices: Introduction
      • 6.1 Requirements
      • 6.2 Creating a Namespace
      • 6.3 Creating the Deployment
      • 6.4 Examining Pods and Deployments
      • 6.5 Accessing Pods
      • 6.6 Exposing a Deployment
        • 6.6.1 ClusterIP Service
        • 6.6.2 NodePort Service
        • 6.6.3 LoadBalancer Service
        • 6.6.4 Headless Service
        • 6.6.5 Ingress Service
    • 7 Deploying Stateful Microservices: Persisting Data in Kubernetes
      • 7.1 Requirements
      • 7.2 Creating a Namespace
      • 7.3 Creating a ConfigMap for the PostgreSQL database
        • 7.3.1 What is a ConfigMap?
        • 7.3.2 ConfigMap for PostgreSQL
      • 7.4 Persisting data storage on PostgreSQL
        • 7.4.1 Kubernetes Volumes
        • 7.4.2 VolumeClaims
        • 7.4.3 StorageClass
        • 7.4.4 Adding storage to PostgreSQL
        • 7.4.5 Creating a Deployment for PostgreSQL
        • 7.4.6 Creating a Service for PostgreSQL
        • 7.4.7 Creating a Deployment for our application
        • 7.4.8 Creating a Service for our application
        • 7.4.9 Creating an external Service for our application
        • 7.4.10 Creating an Ingress for our application
      • 7.5 Checking logs and making sure everything is working
      • 7.6 Summary
    • 8 Deploying Stateful Microservices: StatefulSets
      • 8.1 What is a StatefulSet?
      • 8.2 StatefulSet vs Deployment
      • 8.3 Creating a StatefulSet
      • 8.4 Creating a Service for the StatefulSet
      • 8.5 Post deployment tasks
      • 8.6 StatefulSet vs Deployment: persistent storage
      • 8.7 StatefulSet vs Deployment: associated service
    • 9 Microservices Patterns: Externalized Configurations
      • 9.1 Storing configurations in the environment
      • 9.2 Kubernetes Secrets and environment variables: why?
      • 9.3 Kubernetes Secrets and environment variables: how?
    • 10 Best Practices for Microservices: Health Checks
      • 10.1 Health Checks
      • 10.2 Liveness and Readiness probes
      • 10.3 Types of probes
      • 10.4 Implementing probes
    • 11 Microservices Resource Management Strategies
      • 11.1 Resource management and risks: from Docker to Kubernetes
      • 11.2 Requests and limits
      • 11.3 CPU resource units
      • 11.4 Memory resource units
      • 11.5 Considerations when setting resource requests and limits
      • 11.6 Node reserve resources vs allocatable resources
      • 11.7 Quality of Service (QoS) classes
        • 11.7.1 Guaranteed
        • 11.7.2 Burstable
        • 11.7.3 BestEffort
        • 11.7.4 QoS class of a Pod
        • 11.7.5 Eviction order
        • 11.7.6 PriorityClass: a custom class
    • 12 Autoscaling Microservices in Kubernetes: Introduction
      • 12.1 Best practices for microservices scalability
        • 12.1.1 Use a service registry for service discovery
        • 12.1.2 Implement health checks
        • 12.1.3 Designing for scalability and other best practices
    • 13 Autoscaling Microservices in Kubernetes: Horizontal Autoscaling
      • 13.1 Horizontal scaling
      • 13.2 Horizontal Pod Autoscaler
      • 13.3 Autoscaling based on custom Kubernetes metrics
      • 13.4 Autoscaling based on more specific custom Kubernetes metrics
      • 13.5 Using multiple metrics
      • 13.6 Autoscaling based on custom non-Kubernetes metrics
      • 13.7 Cluster autoscaler
    • 14 Autoscaling Microservices in Kubernetes: Vertical Scaling
      • 14.1 Vertical Scaling
      • 14.2 Vertical Pod Autoscaler
      • 14.3 VPA modes
        • 14.3.1 Auto
        • 14.3.2 Initial
        • 14.3.3 Recreate
        • 14.3.4 Off
      • 14.4 VPA recommendations
        • 14.4.1 VPA Limitations
    • 15 Scaling Stateful Microservices: PostgreSQL as an Example
      • 15.1 StatefulSets and scaling
      • 15.2 Stolon: introduction
      • 15.3 Stolon: installation
      • 15.4 Stolon: usage
    • 16 Microservices Deployment Strategies: One Service Per Node
      • 16.1 DaemonSet: role and use cases
      • 16.2 DaemonSet: creating and managing
    • 17 Microservices Deployment Strategies: Assigning Workloads to Specific Nodes
      • 17.1 Assigning your workloads to specific nodes: why?
      • 17.2 Taints and Tolerations
        • 17.2.1 Taints and Tolerations: definition
        • 17.2.2 Taints and Tolerations: example
      • 17.3 nodeSelector
        • 17.3.1 The simplest form of node affinity
        • 17.3.2 nodeSelector: example
      • 17.4 Node affinity and anti-affinity
        • 17.4.1 Node affinity: like nodeSelector but with more options
        • 17.4.2 Node affinity: example
        • 17.4.3 Node anti-affinity: example
        • 17.4.4 Affinity weight
        • 17.4.5 Affinity and anti-affinity types
    • 18 Kubernetes: Managing Infrastructure Upgrades and Maintenance Mode
      • 18.1 Why do we need to upgrade our infrastructure?
      • 18.2 What to upgrade?
      • 18.3 Upgrading worker nodes: draining
      • 18.4 Upgrading worker nodes: cordoning
      • 18.5 Upgrading Node Pools
      • 18.6 Zero downtime upgrades: Pod Disruption Budgets
    • 19 Microservices Deployment Strategies: Managing Application Updates and Deployment
      • 19.1 Cloud Native practices
      • 19.2 Deployment strategies
        • 19.2.1 Blue/Green deployment: introduction
        • 19.2.2 Canary deployment: introduction
        • 19.2.3 Canary deployment: an example using Istio
        • 19.2.4 Canary Deployment: testing in production
      • 19.3 Rolling updates: definition
        • 19.3.1 Rolling updates: example
    • 20 Microservices Observability in a Kubernetes World: Introduction
      • 20.1 Introduction to observability
      • 20.2 What is monitoring?
      • 20.3 What is observability?
      • 20.4 White-box monitoring vs black-box monitoring
      • 20.5 Pillars of observability
        • 20.5.1 Logs
        • 20.5.2 Metrics
        • 20.5.3 Tracing
        • 20.5.4 Observability pillars in action
      • 20.6 Four golden signals of monitoring
        • 20.6.1 Latency
        • 20.6.2 Traffic
        • 20.6.3 Errors
        • 20.6.4 Saturation
      • 20.7 Monitoring vs Observability: what’s the difference?
    • 21 Microservices Observability in a Kubernetes World: Prometheus, Grafana, Loki, Promtail, OpenTelemetry, and Jaeger
      • 21.1 Introduction to Prometheus
      • 21.2 How Prometheus works
      • 21.3 Installing Prometheus
      • 21.4 Accessing Prometheus web UI
      • 21.5 Metrics available in Prometheus
      • 21.6 Using Grafana to visualize Prometheus metrics
      • 21.7 Promtail: Gathering logs from Kubernetes logs
      • 21.8 Loki logging stack
      • 21.9 Using Loki to query logs
      • 21.10 Using Jaeger and OpenTelemetry for distributed tracing
    • 22 GitOps: Cloud Native Continuous Delivery
      • 22.1 GitOps: introduction and definitions
      • 22.2 GitOps: benefits and drawbacks
      • 22.3 GitOps: tools
    • 23 GitOps: Example of a GitOps workflow using Argo CD
      • 23.1 Argo CD: introduction
      • 23.2 Argo CD: installation and configuration
      • 23.3 Argo CD: creating an application
      • 23.4 Argo CD: automatic synchronization and self-healing
      • 23.5 Argo CD: rollback
      • 23.6 Argo CD the declarative way
      • 23.7 Argo CD: configuration management
      • 23.8 Argo CD: managing different environments
      • 23.9 Argo CD: deployment hooks
    • 24 Creating CI/CD Pipelines for Microservices
      • 24.1 Continuous integration, delivery, and deployment of microservices
      • 24.2 CI/CD tools
        • 24.2.1 Jenkins
        • 24.2.2 Spinnaker
        • 24.2.3 Argo CD
        • 24.2.4 GitHub Actions
        • 24.2.5 GitLab CI/CD
      • 24.3 Creating a CI/CD pipeline for a microservice
        • 24.3.1 Install and configure Argo CD
        • 24.3.2 Create a GitHub repository for our microservice
        • 24.3.3 Create a Docker Hub account
        • 24.3.4 Setting up GitHub Actions
        • 24.3.5 Create a Helm chart
        • 24.3.6 Create an Argo CD Application
        • 24.3.7 Automating the deployment of new versions
    • 25 Afterword
      • 25.1 What’s next?
      • 25.2 Thank you
      • 25.3 About the author
      • 25.4 Join the community
      • 25.5 Feedback

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