Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
DevOps with Kubernetes. - Second Edition

You're reading from  DevOps with Kubernetes. - Second Edition

Product type Book
Published in Jan 2019
Publisher Packt
ISBN-13 9781789533996
Pages 484 pages
Edition 2nd Edition
Languages
Concepts
Authors (3):
Hideto Saito Hideto Saito
Profile icon Hideto Saito
Hui-Chuan Chloe Lee Hui-Chuan Chloe Lee
Profile icon Hui-Chuan Chloe Lee
Cheng-Yang Wu Cheng-Yang Wu
Profile icon Cheng-Yang Wu
View More author details

Table of Contents (14) Chapters

Preface 1. Introduction to DevOps 2. DevOps with Containers 3. Getting Started with Kubernetes 4. Managing Stateful Workloads 5. Cluster Administration and Extension 6. Kubernetes Network 7. Monitoring and Logging 8. Resource Management and Scaling 9. Continuous Delivery 10. Kubernetes on AWS 11. Kubernetes on GCP 12. Kubernetes on Azure 13. Other Books You May Enjoy

DevOps with Containers

We're now familiar with a wide variety of DevOps tools that can help us to automate tasks and manage configuration throughout the delivery journey of an application. Challenges still lie ahead, however, as applications have now become more diverse than ever. In this chapter, we'll add another skill to our tool belt: the container. In particular, we'll talk about the Docker container. In doing this, we'll seek to understand the following:

  • Key concepts related to containers
  • Running Docker applications
  • Building Docker applications with Dockerfile
  • Orchestrating multiple containers with Docker compose

Understanding containers

One of the key features of containers is isolation. In this section, we'll establish a proper understanding of this powerful tool by looking at how a container achieves isolation and why this matters in the software development life cycle.

Resource isolation

When an application launches, it consumes CPU time, occupies memory space, links to its dependent libraries, writes to the disk, transmits packets, and may access other devices as well. Everything it uses up is a kind of resource, which is shared by all the programs on the same host. To increase the efficiency of resource utilization, we may try to put as many applications as possible on a single machine. However, the complexity involved in...

The life cycle of a container

Using containers isn't as intuitive as most of the tools that we're used to working with, so we'll need to change the way we work. In this section, we'll go through how to use Docker so that we're able to benefit from containers.

The basics of Docker

When docker run alpine ls is executed, Docker carries out the following steps behind the scenes:

  1. It finds the alpine image locally. If this is not found, Docker will try to locate and pull it from the public Docker registry to the local image storage.
  2. It extracts the image and creates a container accordingly.
  3. It executes the entry point defined in the image with commands, which are the arguments after the image name. In this...

Working with a Dockerfile

When assembling an image, whether using docker commit or export, optimizing the outcome in a managed way is a challenge, let alone integrating it with a CI/CD pipeline. A Dockerfile represents the building task in the form of code, which significantly reduces the difficulty of building tasks for us. In this section, we'll describe how to map Docker commands into a Dockerfile and take a step towards optimizing it.

Writing your first Dockerfile

A Dockerfile consists of a series of text instructions to guide the Docker daemon to form an image, and a Dockerfile must start with the FROM directive. For example, we may have an image built from the following one-liner:

docker commit $(              ...

Multi-container orchestration

As we pack more and more applications into isolated boxes, we'll soon realize that we need a tool that is able to help us tackle many containers simultaneously. In this section, we'll move a step up from spinning up just one single container to orchestrating multiple containers in a band.

Piling up containers

Modern systems are usually built as stacks made up of multiple components that are distributed over networks, such as application servers, caches, databases, and message queues. Each individual component is also a self-contained system with many sub-components. What's more, the rising trend of microservices introduces additional degrees of complexity into these entangled relationships...

Summary

Starting from the very primitive elements of Linux containers and Docker tool stacks, we went through every aspect of containerizing an application, including packing and running a Docker container, writing a Dockerfile for code-based immutable deployment, and manipulating multiple containers with Docker compose. However, the abilities we gained in this chapter only allow us to run and connect containers within the same host, which limits our ability to build larger applications.

In Chapter 3, Getting Started with Kubernetes, we'll meet Kubernetes, unleashing the power of containers beyond the limits of scale.

lock icon The rest of the chapter is locked
You have been reading a chapter from
DevOps with Kubernetes. - Second Edition
Published in: Jan 2019 Publisher: Packt ISBN-13: 9781789533996
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}