Kubernetes Microservices with Docker (eBook)
XXI, 432 Seiten
Apress (Verlag)
978-1-4842-1907-2 (ISBN)
- How 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
Deepak Vohra is a consultant and a principal member of the NuBean-dot-com software company. Deepak is a Sun-certified Java programmer and Web component developer. He has worked in the fields of XML, Java programming, and Java EE for over five years. Deepak is the coauthor of Pro XML Development with Java Technology (Apress, 2006). Deepak is also the author of the JDBC 4.0 and Oracle JDeveloper for J2EE Development, Processing XML Documents with Oracle JDeveloper 11g, EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g, and Java EE Development in Eclipse IDE (Packthing). He also served as the technical reviewer on WebLogic: The Definitive Guide (O'Reilly Media, 2004) and Ruby Programming for the Absolute Beginner (Cengage Learning PTR, 2007).
Start using Kubernetes in 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, Kubernetes Microservices with Docker 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. "e;a concise but clear introduction to containers, Docker and Kubernetes, using simple real-world examples to pass on the core concepts, via repetition, and is a very useful enabler."e; 10/10Dave Hay MBCS CITP: review for BCS, The Chartered Institute for IT (http://www.bcs.org/content/conWebDoc/58512)What You Will LearnInstall Kubernetes on a single nodeSet environment variablesCreate multi-container pods using DockerUse volumesUse Kubernetes with the Apache Hadoop ecosystem, NoSQL databases, and RDBMSsInstall Kubernetes on a multi-node clusterWho This Book Is ForApplication developers including Apache Hadoop developers, database developers and NoSQL developers.
Deepak Vohra is a consultant and a principal member of the NuBean-dot-com software company. Deepak is an Oracle-certified Java programmer and Web component developer. He has worked in the fields of XML, Java programming, and Java EE for over five years. Deepak is the coauthor of Pro XML Development with Java Technology (Apress, 2006). Deepak is also the author of JDBC 4.0 and Oracle JDeveloper for J2EE Development, Processing XML Documents with Oracle JDeveloper 11g, EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g, and Java EE Development in Eclipse IDE (Packthing). He also served as the technical reviewer on WebLogic: The Definitive Guide (O’Reilly Media, 2004) and Ruby Programming for the Absolute Beginner (Cengage Learning PTR, 2007).
Contents at a Glance 4
Contents 6
About the Author 18
About the Technical Reviewer 20
Foreword 22
Part I: Getting Started 23
Chapter 1: Installing Kubernetes Using Docker 24
Setting the Environment 25
Installing Docker 26
Installing Kubernetes 36
Starting etcd 44
Starting Kubernetes Master 46
Starting Service Proxy 49
Listing the Kubernetes Docker Containers 50
Installing kubectl 53
Listing Services 56
Listing Nodes 57
Testing the Kubernetes Installation 57
Summary 59
Chapter 2: Hello Kubernetes 60
Overview 60
What Is a Node? 60
What Is a Cluster? 61
What Is a Pod? 61
What Is a Service? 61
What Is a Replication Controller? 61
What Is a Label? 62
What Is a Selector? 62
What Is a Name? 62
What Is a Namespace? 62
What Is a Volume? 62
Why Kubernetes? 62
Setting the Environment 63
Creating an Application Imperatively 64
Creating a Service 65
Describing a Pod 67
Invoking the Hello-World Application 68
Scaling the Application 69
Deleting a Replication Controller 73
Deleting a Service 74
Creating an Application Declaratively 74
Creating a Pod Definition 75
Creating a Service Definition 79
Creating a Replication Controller Definition 82
Invoking the Hello-World Application 85
Scaling the Application 89
Using JSON for the Resource Definitions 91
Summary 97
Chapter 3: Using Custom Commands and Environment Variables 98
Setting the Environment 98
The ENTRYPOINT and CMD Instructions 99
The Command and Args Fields in a Pod Definition 100
Environment Variables 101
Using the Default ENTRYPOINT and CMD from a Docker Image 102
Overriding Both the ENTRYPOINT and CMD 105
Specifying both the Executable and the Parameters in the Command Mapping 108
Specifying Both the Executable and the Parameters in the Args Mapping 111
Summary 114
Part II: Relational Databases 115
Chapter 4: Using MySQL Database 116
Setting the Environment 116
Creating a Service 118
Creating a Replication Controller 119
Listing the Pods 123
Listing Logs 123
Describing the Service 125
Starting an Interactive Shell 126
Starting the MySQL CLI 128
Creating a Database Table 129
Exiting the MySQL CLI and Interactive Shell 130
Scaling the Replicas 130
Deleting the Replication Controller 132
Summary 133
Chapter 5: Using PostgreSQL Database 134
Setting the Environment 134
Creating a PostgreSQL Cluster Declaratively 136
Creating a Service 136
Creating a Replication Controller 138
Getting the Pods 142
Starting an Interactive Command Shell 142
Starting the PostgreSQL SQL Terminal 143
Creating a Database Table 144
Exiting the Interactive Command Shell 145
Scaling the PostgreSQL Cluster 146
Listing the Logs 147
Deleting the Replication Controller 149
Stopping the Service 150
Creating a PostgreSQL Cluster Imperatively 150
Creating a Replication Controller 151
Getting the Pods 151
Creating a Service 152
Creating a Database Table 153
Scaling the PostgreSQL Cluster 156
Deleting the Replication Controller 157
Stopping the Service 158
Summary 158
Chapter 6: Using Oracle Database 159
Setting the Environment 159
Creating an Oracle Database Instance Imperatively 160
Listing Logs 162
Creating a Service 163
Scaling the Database 164
Deleting the Replication Controller and Service 165
Creating an Oracle Database Instance Declaratively 166
Creating a Pod 166
Creating a Service 168
Creating a Replication Controller 171
Keeping the Replication Level 174
Scaling the Database 176
Starting the Interactive Shell 177
Connecting to Database 178
Creating a User 179
Creating a Database Table 180
Exiting the Interactive Shell 181
Summary 181
Part III: NoSQL Database 182
Chapter 7: Using MongoDB Database 183
Setting the Environment 183
Creating a MongoDB Cluster Declaratively 185
Creating a Service 185
Creating a Replication Controller 189
Creating a Volume 192
Listing the Logs 194
Starting the Interactive Shell for Docker Container 196
Starting a Mongo Shell 198
Creating a Database 198
Creating a Collection 199
Adding Documents 200
Finding Documents 202
Finding a Single Document 202
Finding Specific Fields in a Single Document 203
Dropping a Collection 204
Exiting Mongo Shell and Interactive Shell 204
Scaling the Cluster 204
Deleting the Replication Controller 205
Deleting the Service 206
Using a Host Port 206
Creating a MongoDB Cluster Imperatively 210
Creating a Replication Controller 210
Listing the Pods 211
Listing the Logs 212
Creating a Service 213
Scaling the Cluster 214
Deleting the Service and Replication Controller 216
Summary 216
Chapter 8: Using Apache Cassandra Database 217
Setting the Environment 217
Creating a Cassandra Cluster Declaratively 219
Creating a Service 219
Creating a Replication Controller 222
Scaling the Database 227
Describing the Pod 228
Starting an Interactive Shell 229
Starting the CQL Shell 231
Creating a Keyspace 231
Altering a Keyspace 231
Using a Keyspace 232
Creating a Table 232
Deleting from a Table 233
Truncating a Table 234
Dropping a Table and Keyspace 234
Creating a Volume 235
Creating a Cassandra Cluster Imperatively 241
Creating a Replication Controller 241
Creating a Service 243
Scaling the Database 244
Deleting the Replication Controller and Service 245
Summary 246
Chapter 9: Using Couchbase 247
Setting the Environment 247
Creating a Couchbase Cluster Declaratively 250
Creating a Pod 250
Creating a Service 253
Creating a Replication Controller 255
Listing the Pods 259
Listing the Logs 259
Describing the Service 260
Listing the Endpoints 260
Setting Port Forwarding 260
Logging into Couchbase Web Console 262
Configuring Couchbase Server 263
Adding Documents 271
Starting an Interactive Shell 280
Using the cbtransfer Tool 281
Creating a Couchbase Cluster Imperatively 282
Creating a Replication Controller 282
Listing the Pods 282
Creating a Service 284
Scaling the Cluster 285
Keeping the Replication Level 286
Setting Port Forwarding 288
Logging in to Couchbase Admin Console 288
Summary 289
Part IV: Apache Hadoop Ecosystem 290
Chapter 10: Using Apache Hadoop Ecosystem 291
Setting the Environment 291
Creating an Apache Hadoop Cluster Declaratively 292
Creating a Service 293
Creating a Replication Controller 295
Listing the Pods 297
Listing Logs 298
Scaling a Cluster 299
Starting an Interactive Shell 300
Running a MapReduce Application 301
Running Hive 310
Running HBase 316
Deleting the Replication Controller and Service 321
Creating an Apache Hadoop Cluster Imperatively 321
Creating a Replication Controller 321
Listing the Pods 322
Scaling a Cluster 323
Creating a Service 323
Starting an Interactive Shell 324
Summary 325
Chapter 11: Using Apache Solr 326
Setting the Environment 327
Creating a Service 328
Listing Service Endpoints 330
Describing the Service 330
Creating a Replication Controller 331
Listing the Pods 334
Describing a Replication Controller 335
Listing the Logs 336
Starting an Interactive Shell 338
Creating a Solr Core 341
Indexing Documents 342
Accessing Solr on Command Line with a REST Client 345
Setting Port Forwarding 350
Accessing Solr in Admin Console 351
Scaling the Cluster 357
Summary 358
Chapter 12: Using Apache Kafka 359
Setting the Environment 360
Modifying the Docker Image 361
Creating a Service 367
Creating a Replication Controller 370
Listing the Pods 373
Describing a Pod 374
Starting an Interactive Shell 375
Starting the Kafka Server 376
Creating a Topic 378
Starting a Kafka Producer 379
Starting a Kafka Consumer 379
Producing and Consuming Messages 379
Scaling the Cluster 380
Deleting Replication Controller and Service 382
Summary 383
Part V: Multi Containers and Nodes 384
Chapter 13: Creating a Multi-Container Pod 385
How to find Number of Containers in a Pod? 386
Types of Applications Using a Multi-Container Pod 386
Setting the Environment 387
Creating a Service 388
Describing a Service 389
Creating a Replication Container 390
Listing the Pods 392
Listing the Docker Containers 393
Describing the Service after Creating Replication Controller 394
Invoking the Hello World Application on Command Line 395
Starting the Interactive Shell 396
Starting PostgreSQL Shell 397
Setting Port Forwarding 397
Opening the Hello World Application in a Browser 398
Scaling the Cluster 399
Listing the Docker Containers 401
Describing the Service after Scaling 402
Setting Port Forwarding 402
Opening the Hello World Application in a Browser 403
Invoking the Hello World Application from Command Line 404
Deleting the Replication Controller 406
Deleting the Service 407
Summary 407
Chapter 14: Installing Kubernetes on a Multi-Node Cluster 408
Components of a Multi-Node Cluster 409
Setting the Environment 409
Installing the Master Node 411
Setting Up Flanneld and etcd 411
Setting up Bootstrap Instance of Docker 411
Setting Up etcd 412
Setting Up Flannel 413
Starting the Kubernetes Master 418
Running the Service Proxy 420
Testing the One-Node Cluster 421
Adding a Worker Node 421
Exporting the Master IP 421
Setting Up Flanneld 422
Starting Up Kubernetes on Worker Node 427
Running the Service Proxy 428
Testing the Kubernetes Cluster 428
Running an Application on the Cluster 428
Exposing the Application as a Service 429
Testing the Application in a Browser 431
Scaling the Application 432
Summary 436
Index 437
Erscheint lt. Verlag | 16.4.2016 |
---|---|
Zusatzinfo | XXI, 432 p. 548 illus., 463 illus. in color. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Mathematik / Informatik ► Informatik ► Datenbanken |
Mathematik / Informatik ► Informatik ► Netzwerke | |
Mathematik / Informatik ► Informatik ► Programmiersprachen / -werkzeuge | |
Schlagworte | Big Data • Clustering • containers • Docker • Kubernetes • Linux • Microservices |
ISBN-10 | 1-4842-1907-4 / 1484219074 |
ISBN-13 | 978-1-4842-1907-2 / 9781484219072 |
Haben Sie eine Frage zum Produkt? |
![PDF](/img/icon_pdf_big.jpg)
Größe: 39,1 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich