Share E-Book
Scan to open this page

Scan with your phone to open this page

AuthorSameer Naik, Sébastien Goasguen, Jonathan Michaux

Kubernetes is the de facto standard for container orchestration and distributed applications management across a microservices framework. With this practical cookbook, you'll learn hands-on Kubernetes recipes for automating the deployment, scaling, and operations of application containers across clusters of hosts. In this fully updated second edition, Sameer Naik, Sébastien Goasguen, and Jonathan Michaux from TriggerMesh provide a problem-solution-discussion format with easy lookups to help you find the detailed answers you need—fast. Kubernetes lets you deploy your applications quickly and predictably, so you can efficiently respond to customer demand. This cookbook delivers the essential knowledge that developers and system administrators need to get there. Recipes in this cookbook focus on:

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical, recipe-driven guide for developers and sysadmins who want to deploy, scale, and operate containerized applications on Kubernetes, covering everything from local development with Minikube to production-grade cluster management, security, and cloud-native tooling. 【Book Arc】 - **Opening (~0%–10%)**: Introduces Kubernetes as the standard for container orchestration, outlines prerequisites (Git, Go basics), and sets up the core tooling—installing `kubectl`, using Minikube for local clusters, and exploring the Kubernetes dashboard. - **Early (~10%–23%)**: Moves from single-node local setups to creating real clusters, covering `kubeadm` for bootstrapping, tainting control-plane nodes for workloads, and downloading official Kubernetes releases and binaries from GitHub. - **Early (~23%–32%)**: Focuses on mastering the Kubernetes client (`kubectl`)—resource aliases, autocompletion, deleting resources, using `kubectl explain` for schema discovery, and creating objects from YAML/JSON manifests via `kubectl apply`. - **Middle (~32%–48%)**: Dives into core workload management: rolling back deployments with `kubectl rollout undo`, running batch jobs with Jobs, deploying per-node daemons with DaemonSets, and exposing services internally and externally, including ingress controllers. - **Middle (~48%–52%)**: Extends into the broader ecosystem, showing how to use Helm for package management (searching Artifact Hub for charts) and preparing for more advanced topics like scaling, security, and the Kubernetes API. 【Key Takeaways】 - **Start local, think cluster** (Early): Minikube gives you a single-node cluster on your laptop with configurable CPU, memory, and node counts—ideal for testing before moving to production. Use `minikube start --nodes=2` to simulate multi-node behavior. - **Master `kubectl` aliases and autocompletion** (Early): Remembering resource names like `po`, `svc`, `deploy`, and `ns` saves time, but enabling shell autocompletion (Recipe 12.1) is the real productivity booster. - **`kubectl explain` is your schema dictionary** (Early): Unlike `kubectl describe` (which shows object values), `kubectl explain` pulls field definitions from the API server's OpenAPI spec—perfect for writing correct manifests without memorizing YAML structure. - **Rollbacks are cheap and safe** (Middle): `kubectl rollout undo deployment myapp --to-revision 2` lets you revert to a known-good state. Note that only pod-template changes (env, ports, image) trigger a rollout; replica-count changes do not. - **Jobs and DaemonSets solve different problems** (Middle): Use Jobs for batch processes that run to completion (backups, migrations), and DaemonSets for infrastructure daemons (like Fluentd) that must run on every node. - **Services are label-driven abstractions** (Middle): A Service's selector determines which pods receive traffic. If a service isn't working, check the selector and verify endpoints with `kubectl get endpoints <service-name>`. - **Ingress controllers are required for external routing** (Middle): Creating an Ingress resource alone isn't enough—you must deploy an ingress controller (e.g., ingress-nginx) to watch the API server and configure routes. - **Helm integrates with Artifact Hub** (Middle): `helm search hub redis` lets you discover and evaluate community charts directly from the CLI, making package management for Kubernetes much easier. 【Reading Tips】 - **Skim Chapter 1–2** if you already have a cluster; focus on the Minikube flags and `kubeadm` taint commands, which are the most reusable bits. - **Deep-read Chapter 3–4** for `kubectl` mastery—the `explain` vs. `describe` distinction and the rollout trigger rules are subtle but critical. - **Pay attention to the "Discussion" sections** after each recipe; they explain *why* a solution works, not just *how*—this is where the real learning happens. - **Use the "See Also" references** to jump between related recipes (e.g., labels in Chapter 7, quotas in Chapter 7.4) when you need to combine concepts. - **Keep a terminal handy** and run the commands as you read; the cookbook format assumes hands-on practice, not passive reading. 【Coverage Limits】 This guide covers the first half of the book (roughly up to 52%), focusing on setup, core workloads, services, and Helm. Later chapters on scaling (Chapter 9), security (Chapter 10), the Kubernetes API (Chapter 7), and advanced topics like cluster resizing are not covered in this sample.
Excerpt 1
88 7.5 Labeling an Object 89 7.6 Using Labels for Queries...
View in text
Excerpt 2
imum version of Kubernetes that they can run on. Figure 1-1. Snapshot of the Docker Desktop Kubernetes settings panel It is worth noting that the version of ...
View in text
Excerpt 3
the Swagger/OpenAPI definitions, exposed by the API server. You can think of kubectl explain as a way to describe the structure of Kubernetes resources, wher...
View in text
Excerpt 4
that make up this microservice abstraction. Kubernetes uses the Service object to dynamically configure the iptables on all the nodes to be able to send the ...
View in text
Excerpt 5
object’s metadata. Any object in Kubernetes can be labeled. Labels are also used by Kubernetes itself for pod selection by deployments (see Recipe 4.1) and s...
View in text
Excerpt 6
e worker node and make sure you can access it with kubectl: $ eksctl create cluster --name supersizeme \ --region eu-central-1 --instance-types t3.small ...
View in text
Excerpt 7
ard deployment generated with kubectl run (see Recipe 4.5): $ kubectl create deployment nginx --image nginx:1.25.2 --replicas 4 When you list the pods and sh...
View in text
Excerpt 8
t kubectl drain $NODE --force will also evict pods not man‐ aged by a ReplicationController, ReplicaSet, Job, DaemonSet, or StatefulSet. See Also • “Safely D...
View in text
Tags
AI categories
Cloud NativeDevOpsBackend
ISBN: 1098142241
Publisher: O'Reilly Media
Publish Year: 2024
Language: English
Pages: 231
File Format: PDF
File Size: 982.0 KB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…