Skip to main content
Top

2016 | Book

Kubernetes Microservices with Docker

insite
SEARCH

About this book

This book on Kubernetes, the container cluster manager, discusses all aspects of using Kubernetes in today's complex big data and enterprise applications, including Docker containers.
Starting with installing Kubernetes on a single node, the book introduces Kubernetes with a simple Hello example and discusses using environment variables in Kubernetes.
Next, the book discusses using Kubernetes with all major groups of technologies such as relational databases, NoSQL databases, and in the Apache Hadoop ecosystem.
The book concludes with using multi container Pods and installing Kubernetes on a multi node cluster. No other book on using Kubernetes - beyond simple introduction - is available in the market.

What You Will LearnHow to install Kubernetes on a single node
How to install Kubernetes on a multi-node cluster
How to set environment variables
How to create a multi-container pods using Docker
How to use volumes
How to use Kubernetes with Apache Hadoop Ecosystem
How to use Kubernetes with NoSQL Databases
How to use Kubernetes with RDBMS
Who This Book Is ForApplication Developers including Apache Hadoop Developers, Database developers and NoSQL Developers.


Table of Contents

Frontmatter

Getting Started

Frontmatter
Chapter 1. Installing Kubernetes Using Docker
Abstract
Kubernetes is software for managing a cluster of Docker containers. Kubernetes orchestration includes scheduling, distributing workload, and scaling. Kubernetes takes the software encapsulation provided by Docker further by introducing pods. A pod is a collection of one or more Docker containers with single interface features such as providing networking and filesystem at the pod level rather than at the container level. Kubernetes also introduces "labels" using that services, and replication controllers (replication controller is used to scale a cluster) identify or select the containers or pods they manage. Kubernetes is lightweight, portable (suited for the cloud architecture), and modular.
Deepak Vohra
Chapter 2. Hello Kubernetes
Abstract
Kubernetes is a cluster manager for Linux containers. While Kubernetes supports other type of containers such as Rocket, and support for more types is to be added, we shall discuss Kubernetes in the context of Docker containers only. Docker is an open source container virtualization platform to build, package, and run distributed applications in containers that are lightweight snapshots of the underlying OS. A Docker image, which is application specific, encapsulates all the required software including dependencies for an application and is used to create Docker containers to run applications in the containers. The Docker containers are isolated from each other and have their own networking and filesystem and provide a Container as a Service (CaaS). Docker is similar to virtual machines based on virtualization platforms such as Oracle VirtualBox and VMWare Player in that it is a virtualization over the underlying OS, but is different in that while a virtual machine makes use of an entire operating system, multiple Docker containers share the kernel and run in isolation on the host OS. Docker containers run on the Docker engine, which runs on the underlying OS kernel.
Deepak Vohra
Chapter 3. Using Custom Commands and Environment Variables
Abstract
Kubernetes orchestrates Docker containers, and the instructions to run for a Docker image are specified in the Dockerfile. The ENTRYPOINT instruction specifies the command to run, and the CMD instruction specifies the default arguments for the ENTRYPOINT command. Kubernetes provides two fields, "Command" and "Args", to be specified for a container image in a Pod definition to override the default settings of ENTRYPOINT and CMD. We shall discuss these fields in this chapter. We shall also discuss using environment variables in a Pod definition’s container mapping with the "env" field mapping.
Deepak Vohra

Relational Databases

Frontmatter
Chapter 4. Using MySQL Database
Abstract
MySQL database is the most commonly used open source database. The Docker image “mysql” could be used to create a Docker container running a MySQL database instance. Running Docker separately for a single MySQL instance or multiple instances lacks the features of scheduling multiple instances, scaling, and providing a service for external clients. In this chapter we shall discuss how the Kubernetes container cluster manager could be used to overcome all of those deficiencies. This chapter has the following sections.
Deepak Vohra
Chapter 5. Using PostgreSQL Database
Abstract
PostgreSQL 9.5 offers several new features such as support for UPSERT, BRIN indexing, faster sorts, and the TABLESAMPLE clause for getting a statistical sample of a large table. In this chapter we shall discuss creating a PostgreSQL 9.5 cluster using the Kubernetes cluster manager. We shall discuss both the imperative approach and the declarative approach to creating and scaling a PostgreSQL cluster. This chapter has the following sections.
Deepak Vohra
Chapter 6. Using Oracle Database
Abstract
Installing and configuring Oracle Database would usually involve downloading the software, setting the kernel parameters, installing and configuring the software, all of which is quite involved. Using Docker containers coordinated with Kubernetes makes the task of installing, configuring, and orchestrating a Oracle Database cluster much easier. Oracle Database cluster consisting of multiple instances could benefit from the scheduling, scalability, distributedness, and failover features of the Kubernetes container cluster manager. In this chapter we shall install Oracle Database using a Docker image for the database. We shall create multiple replicas of the database Pod using a replication controller and expose the database as a service. This chapter has the following sections.
Deepak Vohra

NoSQL Database

Frontmatter
Chapter 7. Using MongoDB Database
Abstract
MongoDB is based on the BSON (binary JSON) storage model. Documents are stored in collections. Being a schema-free data store, no two documents need to be alike in terms of the fields in a BSON document. In a large scale cluster several instances of MongoDB could be running and the following issues could arise.
Deepak Vohra
Chapter 8. Using Apache Cassandra Database
Abstract
The primary key could be a single column or multiple column (compound) row key. A relational database also stores data in table rows, but what makes Cassandra different is that the table rows do not have to follow a fixed schema. Each row in a table could have different columns or some of the columns could be the same as other rows.
Deepak Vohra
Chapter 9. Using Couchbase
Abstract
Couchbase is a distributed NoSQL database based on the JSON data model. Couchbase is faster than MongoDB and Apache Cassandra. Couchbase offers some features not available in MongoDB and Cassandra such as a Graphical User Interface (GUI), the Couchbase Web Console. Couchbase also provides command-line tools such as couchbase-cli, cbbackup, cbrestore, and cbtransfer. Couchbase, being a distributed database, could benefit from the cluster management provided by Kubernetes cluster manager, which is what we shall discuss in this chapter. This chapter has the following sections.
Deepak Vohra

Apache Hadoop Ecosystem

Frontmatter
Chapter 10. Using Apache Hadoop Ecosystem
Abstract
Apache Hadoop has evolved to be the de facto framework for processing large quantities of data. Apache Hadoop ecosystem consists of a several projects including Apache Hive and Apache HBase. The Docker image "svds/cdh" is based on the latest CDH release and includes all the main frameworks in the Apache Hadoop ecosystem. All the frameworks such as Apache Hadoop, Apache Hive, and Apache HBase are installed in the same Docker image as a result facilitating development of applications that make use of multiple frameworks from the Apache Hadoop ecosystem. In this chapter we shall discuss using Kubernetes cluster manager to manage a cluster of Pods based on the svds/cdh image.
Deepak Vohra
Chapter 11. Using Apache Solr
Abstract
Apache Solr is an Apache Lucene-based enterprise search platform providing features such as full-text search, near real-time indexing, and database integration. Apache Solr runs as a full-text search server within a servlet container, the default being Jetty, which is included with the Solr installation. In this chapter we shall discuss using Kubernetes cluster manager with Apache Solr. We shall be using only the declarative approach, which makes use of definition files, for creating and managing a Solr cluster. This chapter has the following sections.
Deepak Vohra
Chapter 12. Using Apache Kafka
Abstract
Apache Kafka is publish-subscribe, high throughput, distributed messaging system. A single broker in Kafka could handle 100s MB (Terabytes)/sec of reads & writes from multiple clients. Messages are replicated across the cluster and persisted to disk. Kafka could be used for stream processing, web site activity tracking, metrics collection, and monitoring and log aggregation.
Deepak Vohra

Multi Containers and Nodes

Frontmatter
Chapter 13. Creating a Multi-Container Pod
Abstract
A Pod is the atomic unit of an application managed by Kubernetes. A Pod has a single filesystem and IP Address; the containers in the Pod share the filesystem and networking IP. A Pod could consist of one or more containers. A Pod is defined in a definition file for a Pod or a replication controller using the specification for a Pod
Deepak Vohra
Chapter 14. Installing Kubernetes on a Multi-Node Cluster
Abstract
In all of the preceding chapters in the book we have used a single-node cluster. For most small scale applications a single-node cluster should suffice. But, for relatively large scale, distributed applications a multi-node cluster is a more suitable option. In this chapter we shall install Kubernetes on a multi-node (2 nodes) cluster. This chapter has the following sections.
Deepak Vohra
Backmatter
Metadata
Title
Kubernetes Microservices with Docker
Author
Deepak Vohra
Copyright Year
2016
Publisher
Apress
Electronic ISBN
978-1-4842-1907-2
Print ISBN
978-1-4842-1906-5
DOI
https://doi.org/10.1007/978-1-4842-1907-2

Premium Partner