BACKGROUND IMAGE: iSTOCK/GETTY IMAGES
When enterprise IT teams start out with Kubernetes, a lot can go wrong. In two Kubernetes books, the authors take...
an incremental approach to help readers absorb application deployment and architecture lessons that ease the transition to containers.
"The stuff that we build is really important, but it can be complicated at times," said Brendan Burns, Microsoft distinguished engineer and co-author on both Kubernetes books. "People try to master the whole thing all at once," he added, and the concepts can be opaque until you start to use the tool.
The abstraction that Kubernetes provides -- decoupling the infrastructure from the application -- enables a DevOps approach to code deployment, Burns said. New projects are easier to fit into the Docker containers and Kubernetes orchestration model, but repeatability, code review, immutability and standardized practices aren't limited to greenfield apps. "Even for companies with a lot of code, efficiency is worth [transitioning to containers]," Burns said. "It's 100% fine to run a fat, heavy container." Organizations should host monoliths in containers orchestrated by Kubernetes and use this model to slowly slice that monolith apart with distributed services implemented with the original app.
While Kubernetes simplifies container provisioning and operation, users face manifold decisions around application efficiency and scalability. For example, Burns said, Kubernetes has specific objects for replication, stateful and other deployments; external or internal load balancer options; and debugging and inspection tools that provide multiple ways to troubleshoot incorrect operations.
Burns, Kelsey Hightower and Joe Beda wrote Kubernetes: Up and Running: Dive Into the Future of Infrastructure to help DevOps and other IT teams use Kubernetes and build apps on top of it; the book assumes a reliable Kubernetes deployment. Kubernetes: Up and Running is available from O'Reilly Media.
This book brings readers from their first container build and Kubernetes cluster through common kubectl commands and API objects and then the bulk of deployment considerations: pod operations, services and replicas, storage and more. The final chapter walks through three examples that run the gamut of real-world app deployments. "We didn't want to write an app from scratch because it will be a little toy that is just for demo purposes," Burns said. Instead, the examples are popular scenarios that readers can relate to their own jobs.
Users learn the power of Kubernetes once they get into objects, such as ReplicaSets. "Once you can run one pod well, you want to run multiple for resiliency or to scale out," Burns said. ReplicaSets act like a cookie cutter, creating identical copies of a pod, as many as the user specifies. The next consideration is how to allocate and balance the load across these copies. Chapter 4, "Common kubectl Commands," delves into API objects:
Everything contained in Kubernetes is represented by a RESTful resource. Throughout this book, we refer to these resources as Kubernetes objects. Each Kubernetes object exists at a unique HTTP path; for example, https://your-k8s.com/api/v1/namespaces/default/pods/my-pod leads to the representation of a pod in the default namespace named my-pod. The kubectl command makes HTTP requests to these URLs to access the Kubernetes objects that reside at these paths.
Managing Kubernetes: Operating Kubernetes Clusters in the Real World, an upcoming Kubernetes book that Burns coauthored with Craig Tracey, will cover how to keep the tool working, its architecture, upgrade decisions, how to handle backup and disaster recovery, and other operational concerns around Kubernetes. Managing Kubernetes comes out in November 2018; O'Reilly Media publishes both Kubernetes books.