Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learn Docker - Fundamentals of Docker 18.x

You're reading from   Learn Docker - Fundamentals of Docker 18.x Everything you need to know about containerizing your applications and running them in production

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher Packt
ISBN-13 9781788997027
Length 398 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Dr. Gabriel N. Schenker Dr. Gabriel N. Schenker
Author Profile Icon Dr. Gabriel N. Schenker
Dr. Gabriel N. Schenker
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Title Page
Packt Upsell
Contributors
Preface
1. What Are Containers and Why Should I Use Them? 2. Setting up a Working Environment FREE CHAPTER 3. Working with Containers 4. Creating and Managing Container Images 5. Data Volumes and System Management 6. Distributed Application Architecture 7. Single-Host Networking 8. Docker Compose 9. Orchestrators 10. Introduction to Docker Swarm 11. Zero Downtime Deployments and Secrets 12. Introduction to Kubernetes 13. Deploying, Updating, and Securing an Application with Kubernetes 14. Running a Containerized App in the Cloud 1. Assessment 2. Other Books You May Enjoy Index

Chapter 13


  1. Assuming we have a Docker image in a registry for the two application services, the web API and Mongo DB, we then need to do the following:
    • Define a deployment for Mongo DB using a  StatefulSet; let's call this deployment db-deployment. The StatefulSet should have one replica (replicating Mongo DB is a bit more involved and is outside of the scope of this book).
    • Define a Kubernetes service called db of type ClusterIP for the db-deployment.
    • Define a deployment for the web API; let's call it web-deployment. Let's scale this service to three instances.
    • Define a Kubernetes service called api of type NodePort for web-deployment.
    • If we use secrets, then define those secrets directly in the cluster using kubectl.
    • Deploy the application using kubectl.
  1. To implement layer 7 routing for an application, we ideally use an IngressController. The IngressController is a reverse proxy such as Nginx that has a sidecar listening on the Kubernetes Server API for relevant changes and updating the reverse proxy's configuration and restarting it, if such a change has been detected. We then need to define Ingress resources in the cluster which define the routing, for example from a context-based route such as  https://example.com/pets  to <a service name>/<port> pair such as  api/32001. The moment Kubernetes creates or changes this Ingress object, the IngressController's sidecar picks it up and updates the proxy's routing configuration.
  2. Assuming this is a cluster internal inventory service:
    • When deploying version 1.0 we define a deployment called inventory-deployment-blue and label the pods with a label color: blue.
    • We deploy the Kubernetes service of type ClusterIP called inventory for the preceding deployment with the selector containing color: blue.
    • When ready to deploy the new version of the payments service, we first define a deployment for version 2.0 of the service and call it inventory-deployment-green. We add a label color: green to the pods. 
    • We can now smoke test the "green" service and when everything is OK, we can update the inventory service such as the selector contains color: green.
  3. Some type of information that is confidential and thus should be provided to services through Kubernetes secrets include: passwords, certificates, API key IDs, API key secrets or tokens.
  4. Sources for secret values can be files or base64 encoded values.
lock icon The rest of the chapter is locked
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 £13.99/month. Cancel anytime
Visually different images