Kubernetes for Developers

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

A clear and practical beginner’s guide that shows you just how easy it can be to make the switch to Kubernetes! Kubernetes for Developers reveals practical and painless methods for deploying your apps on Kubernetes—even for small-to-medium sized applications! You’ll learn how to migrate your existing apps onto Kubernetes without a rebuild, and implement modern cloud native architectures that can handle your future growth. Inside, you’ll learn how to: • Containerize a web application with Docker • Host a containerized app on Kubernetes with a public cloud service • Save money and improve performance with cloud native technologies • Make your deployments reliable and fault tolerant • Prepare your deployments to scale without a redesign • Monitor, debug and tune application deployments on Kubernetes Designed for busy working developers, this hands-on guide helps your first steps into Kubernetes using the powerful Google Kubernetes Engine (GKE) service. Learn how the GKE’s powerful automation tools can perform automatic checks and scaling, giving you more time to spend developing great applications. You’ll soon see that you don’t need to incur huge costs or have the manpower of an enterprise organization to get a productivity boost from Kubernetes! About the technology Modern software needs to perform at scale while effectively handling load balancing, state and security. Kubernetes makes these tasks easier and more reliable for apps of any size. This book, written especially for software developers creating applications that run on Kubernetes, shows you exactly how to address these and other important issues. About the book Kubernetes for Developers covers everything you need to know to containerize and deploy an app on Kubernetes from the developer’s perspective. You’ll start by creating a small application you can run on a cloud-based Kubernetes cluster. Then, you’ll systematically explore best practices for stable long-term deployment, including scaling, capacity planning, and resource optimization. What's inside • Deploying reliable web applications using automated operations • Scaling up without an application redesign • Monitoring, debugging, and tuning workloads About the reader For developers familiar with building or deploying web applications. No Docker or Kubernetes experience required. About the author William Denniss is a product manager at Google working on Google Kubernetes Engine.

Author(s): William Denniss
Edition: 1
Publisher: Manning Publications
Year: 2024

Language: English
Commentary: Publisher's PDF
Pages: 320
City: Shelter Island, NY
Tags: DevOps; Security; Scalability; Docker; Deployment; Application Development; Kubernetes; Automation; Configuration as Code; Stateful Applications; GitOps; Containers; Resource Management

Kubernetes for Developers
brief contents
contents
preface
acknowledgments
about this book
Who should read the book
How this book is organized
About the code
liveBook discussion forum
Additional online resources
about the author
about the cover illustration
Part 1—Getting started with Kubernetes
1 Kubernetes for application deployment
1.1 Why containers?
1.1.1 Container benefits
1.2 Why Kubernetes?
1.2.1 Composable building blocks
1.2.2 Features and benefits
1.2.3 Kubernetes vs. platforms as a service
1.2.4 When (not) to use Kubernetes
Summary
2 Containerizing apps
2.1 Building Docker containers
2.1.1 Developer setup
2.1.2 Running commands in Docker
2.1.3 Building our own images
2.1.4 Using base images
2.1.5 Adding a default command
2.1.6 Adding dependencies
2.1.7 Compiling code in Docker
2.1.8 Compiling code with a multistage build
2.2 Containerizing a server application
2.2.1 Containerizing an application server
2.2.2 Debugging
2.3 Using Docker Compose for local testing
2.3.1 Mapping folders locally
2.3.2 Adding service dependencies
2.3.3 Faking external dependencies
Summary
3 Deploying to Kubernetes
3.1 Kubernetes architecture
3.1.1 The Kubernetes cluster
3.1.2 Kubernetes objects
3.2 Deploying an application
3.2.1 Creating a cluster
3.2.2 Uploading your container
3.2.3 Deploying to Kubernetes
3.2.4 The PodSpec
3.2.5 Publishing your Service
3.2.6 Interacting with the Deployment
3.2.7 Updating your application
3.2.8 Cleaning up
3.3 Imperative commands
3.4 Local Kubernetes environments
3.4.1 Docker Desktop’s Kubernetes cluster
3.4.2 Minikube
3.4.3 Using your local Kubernetes cluster
Summary
4 Automated operations
4.1 Automated uptime with health checks
4.1.1 Liveness and readiness probes
4.1.2 Adding a readiness probe
4.1.3 Adding a liveness probe
4.1.4 Designing good health checks
4.1.5 Rescheduling unready containers
4.1.6 Probe types
4.2 Updating live applications
4.2.1 Rolling update strategy
4.2.2 Re-create strategy
4.2.3 Blue/green strategy
4.2.4 Choosing a rollout strategy
Summary
5 Resource management
5.1 Pod scheduling
5.1.1 Specifying Pod resources
5.1.2 Quality of service
5.1.3 Evictions, priority, and preemption
5.2 Calculating Pod resources
5.2.1 Setting memory requests and limits
5.2.2 Setting CPU requests and limits
5.2.3 Reducing costs by overcommitting CPU
5.2.4 Balancing Pod replicas and internal Pod concurrency
Summary
Part 2—Going to production
6 Scaling up
6.1 Scaling Pods and nodes
6.2 Horizontal Pod autoscaling
6.2.1 External metrics
6.3 Node autoscaling and capacity planning
6.3.1 Cluster autoscaling
6.3.2 Spare capacity with cluster autoscaling
6.4 Building your app to scale
6.4.1 Avoiding state
6.4.2 Microservice architectures
6.4.3 Background tasks
Summary
7 Internal services and load balancing
7.1 Internal services
7.1.1 Kubernetes cluster networking
7.1.2 Creating an internal service
7.1.3 Service discovery
7.2 Ingress: HTTP(S) load balancing
7.2.1 Securing connections with TLS
Summary
8 Node feature selection
8.1 Node feature selection
8.1.1 Node selectors
8.1.2 Node affinity and anti-affinity
8.1.3 Tainting nodes to prevent scheduling by default
8.1.4 Workload separation
8.2 Placing Pods
8.2.1 Building highly available deployments
8.2.2 Co-locating interdependent Pods
8.2.3 Avoiding certain Pods
8.3 Debugging placement problems
8.3.1 Placement rules don’t appear to work
8.3.2 Pods are pending
Summary
9 Stateful applications
9.1 Volumes, persistent volumes, claims, and storage classes
9.1.1 Volumes
9.1.2 Persistent volumes and claims
9.1.3 Storage classes
9.1.4 Single-Pod stateful workload deployments
9.2 StatefulSet
9.2.1 Deploying StatefulSet
9.2.2 Deploying a multirole StatefulSet
9.3 Migrating/recovering disks
9.4 Generic ephemeral volume for scratch space
Summary
10 Background processing
10.1 Background processing queues
10.1.1 Creating a custom task queue
10.1.2 Signal handling in worker Pods
10.1.3 Scaling worker Pods
10.1.4 Open source task queues
10.2 Jobs
10.2.1 Running one-off tasks with Jobs
10.2.2 Scheduling tasks with CronJobs
10.3 Batch task processing with Jobs
10.3.1 Dynamic queue processing with Jobs
10.3.2 Static queue processing with Jobs
10.4 Liveness probes for background tasks
Summary
11 GitOps: Configuration as code
11.1 Production and staging environments using namespaces
11.1.1 Deploying to our new namespace
11.1.2 Syncing mutations from the cluster
11.2 Configuration as code the Kubernetes way
11.3 Rolling out safely
11.3.1 Deployment pipelines
11.3.2 Continuous deployment with Cloud Build
11.4 Secrets
11.4.1 String-based (password) secrets
11.4.2 Base64 encoded secrets
11.4.3 File-based secrets
11.4.4 Secrets and GitOps
Summary
12 Securing Kubernetes
12.1 Staying up to date
12.1.1 Cluster and node updates
12.1.2 Updating containers
12.1.3 Handling disruptions
12.2 Deploying node agents with DaemonSet
12.3 Pod security context
12.4 Non-root containers
12.5 Admission controllers
12.5.1 Pod Security admission
12.5.2 Balancing security with compatibility
12.6 Role-based access control
12.7 Next steps
12.7.1 Network policies
12.7.2 Container isolation
12.7.3 Cluster hardening
Summary
index
Numerics
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W