0%

Harness Kubernetes' extensibility to deploy modern patterns and learn to effectively handle production issues

Key Features

  • Build and run efficient cloud-native applications on Kubernetes using industry best practices
  • Operate Kubernetes in a production environment, troubleshoot clusters, and address security concerns
  • Deploy cutting-edge Kubernetes patterns such as service mesh and serverless to your cluster

Book Description

Kubernetes is a modern cloud native container orchestration tool and one of the most popular open source projects worldwide. In addition to the technology being powerful and highly flexible, Kubernetes engineers are in high demand across the industry.

This book is a comprehensive guide to deploying, securing, and operating modern cloud native applications on Kubernetes. From the fundamentals to Kubernetes best practices, the book covers essential aspects of configuring applications. You'll even explore real-world techniques for running clusters in production, tips for setting up observability for cluster resources, and valuable troubleshooting techniques. Finally, you'll learn how to extend and customize Kubernetes, as well as gaining tips for deploying service meshes, serverless tooling, and more on your cluster.

By the end of this Kubernetes book, you'll be equipped with the tools you need to confidently run and extend modern applications on Kubernetes.

What you will learn

  • Set up Kubernetes and configure its authentication
  • Deploy your applications to Kubernetes
  • Configure and provide storage to Kubernetes applications
  • Expose Kubernetes applications outside the cluster
  • Control where and how applications are run on Kubernetes
  • Set up observability for Kubernetes
  • Build a continuous integration and continuous deployment (CI/CD) pipeline for Kubernetes
  • Extend Kubernetes with service meshes, serverless, and more

Who this book is for

This book is for developers, architects, DevOps engineers, or anyone interested in developing and managing cloud-native applications. Those already running cloud applications and looking for a better way to manage their platform or others interested in a career change given the recent popularity of Kubernetes will also find this book helpful. Some familiarity with cloud computing, containers and DevOps is required, but no prior knowledge of building production applications using Kubernetes is needed to get started with this book.

Table of Contents

  1. Cloud Native with Kubernetes
  2. Why subscribe?
  3. Contributors
  4. About the author
  5. About the reviewer
  6. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  8. Section 1: Setting Up Kubernetes
  9. Chapter 1: Communicating with Kubernetes
    1. Technical requirements
    2. Introducing container orchestration
    3. What is container orchestration?
    4. Benefits of container orchestration
    5. Popular orchestration tools
    6. Kubernetes' architecture
    7. Kubernetes node types
    8. The Kubernetes control plane
    9. The Kubernetes API server
    10. The Kubernetes scheduler
    11. The Kubernetes controller manager
    12. etcd
    13. The Kubernetes worker nodes
    14. kubelet
    15. kube-proxy
    16. The container runtime
    17. Addons
    18. Authentication and authorization on Kubernetes
    19. Namespaces
    20. Users
    21. Authentication methods
    22. Kubernetes' certificate infrastructure for TLS and security
    23. Authorization options
    24. RBAC
    25. ABAC
    26. Using kubectl and YAML
    27. Setting up kubectl and kubeconfig
    28. Imperative versus declarative commands
    29. Writing Kubernetes resource YAML files
    30. Summary
    31. Questions
    32. Further reading
  10. Chapter 2: Setting Up Your Kubernetes Cluster
    1. Technical requirements
    2. Options for creating a cluster
    3. minikube – an easy way to start
    4. Installing minikube
    5. Creating a cluster on minikube
    6. Managed Kubernetes services
    7. Benefits of managed Kubernetes services
    8. Drawbacks of managed Kubernetes services
    9. AWS – Elastic Kubernetes Service
    10. Getting started
    11. Google Cloud – Google Kubernetes Engine
    12. Getting started
    13. Microsoft Azure – Azure Kubernetes Service
    14. Getting started
    15. Programmatic cluster creation tools
    16. Kubeadm
    17. Kops
    18. Kubespray
    19. Creating a cluster with Kubeadm
    20. Installing Kubeadm
    21. Starting the master nodes
    22. Starting the worker nodes
    23. Setting up kubectl
    24. Creating a cluster with Kops
    25. Installing on macOS
    26. Installing on Linux
    27. Installing on Windows
    28. Setting up credentials for Kops
    29. Setting up state storage
    30. Creating clusters
    31. Creating a cluster completely from scratch
    32. Provisioning your nodes
    33. Creating the Kubernetes certificate authority for TLS
    34. Creating config files
    35. Creating an etcd cluster and configuring encryption
    36. Bootstrapping the control plane component
    37. Bootstrapping the worker node
    38. Summary
    39. Questions
    40. Further reading
  11. Chapter 3: Running Application Containers on Kubernetes
    1. Technical requirements
    2. What is a Pod?
    3. Implementing Pods
    4. Pod paradigms
    5. Pod networking
    6. Pod storage
    7. Namespaces
    8. The Pod life cycle
    9. Understanding the Pod resource spec
    10. Summary
    11. Questions
    12. Further reading
  12. Section 2: Configuring and Deploying Applications on Kubernetes
  13. Chapter 4: Scaling and Deploying Your Application
    1. Technical requirements
    2. Understanding Pod drawbacks and their solutions
    3. Pod controllers
    4. Using ReplicaSets
    5. Replicas
    6. Selector
    7. Template
    8. Testing a ReplicaSet
    9. Controlling Deployments
    10. Controlling Deployments with imperative commands
    11. Harnessing the Horizontal Pod Autoscaler
    12. Implementing DaemonSets
    13. Understanding StatefulSets
    14. Using Jobs
    15. CronJobs
    16. Putting it all together
    17. Summary
    18. Questions
    19. Further reading
  14. Chapter 5: Services and Ingress – Communicating with the Outside World
    1. Technical requirement
    2. Understanding Services and cluster DNS
    3. Cluster DNS
    4. Service proxy types
    5. Implementing ClusterIP
    6. Protocol
    7. Using NodePort
    8. Setting up a LoadBalancer Service
    9. Creating an ExternalName Service
    10. Configuring Ingress
    11. Ingress controllers
    12. Summary
    13. Questions
    14. Further reading
  15. Chapter 6: Kubernetes Application Configuration
    1. Technical requirements
    2. Configuring containerized applications using best practices
    3. Understanding ConfigMaps
    4. Understanding Secrets
    5. Implementing ConfigMaps
    6. From text values
    7. From files
    8. From environment files
    9. Mounting a ConfigMap as a volume
    10. Mounting a ConfigMap as an environment variable
    11. Using Secrets
    12. From files
    13. Manual declarative approach
    14. Mounting a Secret as a volume
    15. Mounting a Secret as an environment variable
    16. Implementing encrypted Secrets
    17. Checking whether your Secrets are encrypted
    18. Disabling cluster encryption
    19. Summary
    20. Questions
    21. Further reading
  16. Chapter 7: Storage on Kubernetes
    1. Technical requirements
    2. Understanding the difference between volumes and persistent volumes
    3. Volumes
    4. Persistent volumes
    5. Persistent volume claims
    6. Attaching Persistent Volume Claims (PVCs) to Pods
    7. Persistent volumes without cloud storage
    8. Installing Rook
    9. The rook-ceph-block storage class
    10. The Rook Ceph filesystem
    11. Summary
    12. Questions
    13. Further reading
  17. Chapter 8: Pod Placement Controls
    1. Technical requirements
    2. Identifying use cases for Pod placement
    3. Kubernetes node health placement controls
    4. Applications requiring different node types
    5. Applications requiring specific data compliance
    6. Multi-tenant clusters
    7. Multiple failure domains
    8. Using node selectors and node name
    9. Implementing taints and tolerations
    10. Multiple taints and tolerations
    11. Controlling Pods with node affinity
    12. Using requiredDuringSchedulingIgnoredDuringExecution node affinities
    13. Using preferredDuringSchedulingIgnoredDuringExecution node affinities
    14. Multiple node affinities
    15. Using inter-Pod affinity and anti-affinity
    16. Pod affinities
    17. Pod anti-affinities
    18. Combined affinity and anti-affinity
    19. Pod affinity and anti-affinity limitations
    20. Pod affinity and anti-affinity namespaces
    21. Summary
    22. Questions
    23. Further reading
  18. Section 3: Running Kubernetes in Production
  19. Chapter 9: Observability on Kubernetes
    1. Technical requirements
    2. Understanding observability on Kubernetes
    3. Understanding what matters for Kubernetes cluster and application health
    4. Using default observability tooling
    5. Metrics on Kubernetes
    6. Logging on Kubernetes
    7. Installing Kubernetes Dashboard
    8. Alerts and traces on Kubernetes
    9. Enhancing Kubernetes observability using the best of the ecosystem
    10. Introducing Prometheus and Grafana
    11. Implementing the EFK stack on Kubernetes
    12. Implementing distributed tracing with Jaeger
    13. Third-party tooling
    14. Summary
    15. Questions
    16. Further reading
  20. Chapter 10: Troubleshooting Kubernetes
    1. Technical requirements
    2. Understanding failure modes for distributed applications
    3. The network is reliable
    4. Latency is zero
    5. Bandwidth is infinite
    6. The network is secure
    7. The topology doesn't change
    8. There is only one administrator
    9. Transport cost is zero
    10. The network is homogeneous
    11. Troubleshooting Kubernetes clusters
    12. Case study – Kubernetes Pod placement failure
    13. Troubleshooting applications on Kubernetes
    14. Case study 1 – Service not responding
    15. Case study 2 – Incorrect Pod startup command
    16. Case study 3 – Pod application malfunction with logs
    17. Summary
    18. Questions
    19. Further reading
  21. Chapter 11: Template Code Generation and CI/CD on Kubernetes
    1. Technical requirements
    2. Understanding options for template code generation on Kubernetes
    3. Helm
    4. Kustomize
    5. Implementing templates on Kubernetes with Helm and Kustomize
    6. Using Helm with Kubernetes
    7. Using Kustomize with Kubernetes
    8. Understanding CI/CD paradigms on Kubernetes – in-cluster and out-of-cluster
    9. Out-of-cluster CI/CD
    10. In-cluster CI/CD
    11. Implementing in-cluster and out-of-cluster CI/CD with Kubernetes
    12. Implementing Kubernetes CI with AWS Codebuild
    13. Implementing Kubernetes CI with FluxCD
    14. Summary
    15. Questions
    16. Further reading
  22. Chapter 12: Kubernetes Security and Compliance
    1. Technical requirements
    2. Understanding security on Kubernetes
    3. Reviewing CVEs and security audits for Kubernetes
    4. Understanding CVE-2016-1905 – Improper admission control
    5. Understanding CVE-2018-1002105 – Connection upgrading to the backend
    6. Understanding the 2019 security audit results
    7. Implementing tools for cluster configuration and container security
    8. Using admission controllers
    9. Enabling Pod security policies
    10. Using network policies
    11. Handling intrusion detection, runtime security, and compliance on Kubernetes
    12. Installing Falco
    13. Understanding Falco's capabilities
    14. Mapping Falco to compliance and runtime security use cases
    15. Summary
    16. Questions
    17. Further reading
  23. Section 4: Extending Kubernetes
  24. Chapter 13: Extending Kubernetes with CRDs
    1. Technical requirements
    2. How to extend Kubernetes with custom resource definitions
    3. Writing a custom resource definition
    4. Self-managing functionality with Kubernetes operators
    5. Mapping the operator control loop
    6. Designing an operator for a custom resource definition
    7. Using cloud-specific Kubernetes extensions
    8. Understanding the cloud-controller-manager component
    9. Installing cloud-controller-manager
    10. Understanding the cloud-controller-manager capabilities
    11. Using external-dns with Kubernetes
    12. Using the cluster-autoscaler add-on
    13. Integrating with the ecosystem
    14. Introducing the Cloud Native Computing Foundation
    15. Summary
    16. Questions
    17. Further reading
  25. Chapter 14: Service Meshes and Serverless
    1. Technical requirements
    2. Using sidecar proxies
    3. Using NGINX as a sidecar reverse proxy
    4. Using Envoy as a sidecar proxy
    5. Adding a service mesh to Kubernetes
    6. Setting up Istio on Kubernetes
    7. Implementing serverless on Kubernetes
    8. Using Knative for FaaS on Kubernetes
    9. Using OpenFaaS for FaaS on Kubernetes
    10. Summary
    11. Questions
    12. Further reading
  26. Chapter 15: Stateful Workloads on Kubernetes
    1. Technical requirements
    2. Understanding stateful applications on Kubernetes
    3. Popular Kubernetes-native stateful applications
    4. Understanding strategies for running stateful applications on Kubernetes
    5. Deploying object storage on Kubernetes
    6. Installing the Minio Operator
    7. Installing Krew and the Minio kubectl plugin
    8. Starting the Minio Operator
    9. Creating a Minio tenant
    10. Accessing the Minio console
    11. Running DBs on Kubernetes
    12. Running CockroachDB on Kubernetes
    13. Testing CockroachDB with SQL
    14. Implementing messaging and queues on Kubernetes
    15. Deploying RabbitMQ on Kubernetes
    16. Summary
    17. Questions
    18. Further reading
  27. Assessments
    1. Chapter 1 – Communicating with Kubernetes
    2. Chapter 2 – Setting Up Your Kubernetes Cluster
    3. Chapter 3 – Running Application Containers on Kubernetes
    4. Chapter 4 – Scaling and Deploying Your Application
    5. Chapter 5 – Services and Ingress – Communicating with the Outside World
    6. Chapter 6 – Kubernetes Application Configuration
    7. Chapter 7 – Storage on Kubernetes
    8. Chapter 8 – Pod Placement Controls
    9. Chapter 9 – Observability on Kubernetes
    10. Chapter 10 – Troubleshooting Kubernetes
    11. Chapter 11 – Template Code Generation and CI/CD on Kubernetes
    12. Chapter 12 – Kubernetes Security and Compliance
    13. Chapter 13 – Extending Kubernetes with CRDs
    14. Chapter 14 – Service Meshes and Serverless
    15. Chapter 15 – Stateful Workloads on Kubernetes
  28. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
3.146.105.194