Chapter 2. First steps with Docker and Kubernetes

 

This chapter covers

  • Creating, running, and sharing a container image with Docker
  • Running a single-node Kubernetes cluster locally
  • Setting up a Kubernetes cluster on Google Kubernetes Engine
  • Setting up and using the kubectl command-line client
  • Deploying an app on Kubernetes and scaling it horizontally

Before you start learning about Kubernetes concepts in detail, let’s see how to create a simple application, package it into a container image, and run it in a managed Kubernetes cluster (in Google Kubernetes Engine) or in a local single-node cluster. This should give you a slightly better overview of the whole Kubernetes system and will make it easier to follow the next few chapters, where we’ll go over the basic building blocks and concepts in Kubernetes.

2.1. Creating, running, and sharing a container image

As you’ve already learned in the previous chapter, running applications in Kubernetes requires them to be packaged into container images. We’ll do a basic introduction to using Docker in case you haven’t used it yet. In the next few sections you’ll

  1. Install Docker and run your first “Hello world” container
  2. Create a trivial Node.js app that you’ll later deploy in Kubernetes
  3. Package the app into a container image so you can then run it as an isolated container
  4. Run a container based on the image
  5. Push the image to Docker Hub so that anyone anywhere can run it

2.1.1. Installing Docker and running a Hello World container

 

2.1.2. Creating a trivial Node.js app

 

2.1.3. Creating a Dockerfile for the image

 

2.1.4. Building the container image

 
 
 
 

2.1.5. Running the container image

 
 
 

2.1.6. Exploring the inside of a running container

 
 

2.1.7. Stopping and removing a container

 
 

2.1.8. Pushing the image to an image registry

 
 

2.2. Setting up a Kubernetes cluster

 

2.2.1. Running a local single-node Kubernetes cluster with Minikube

 
 

2.2.2. Using a hosted Kubernetes cluster with Google Kubernetes Engine

 
 
 

2.2.3. Setting up an alias and command-line completion for kubectl

 
 
 

2.3. Running your first app on Kubernetes

 
 
 
 

2.3.1. Deploying your Node.js app

 

2.3.2. Accessing your web application

 
 
 
 

2.3.3. The logical parts of your system

 
 
 

2.3.4. Horizontally scaling the application

 
 
 

2.3.5. Examining what nodes your app is running on

 
 
 

2.3.6. Introducing the Kubernetes dashboard

 
 
 
 

2.4. Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest