Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Troubleshooting Docker

You're reading from   Troubleshooting Docker Develop, test, automate, and deploy production-ready Docker containers

Arrow left icon
Product type Paperback
Published in Mar 2017
Publisher Packt
ISBN-13 9781783552344
Length 290 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (4):
Arrow left icon
John Wooten John Wooten
Author Profile Icon John Wooten
John Wooten
Navid Ahmed Shaikh Navid Ahmed Shaikh
Author Profile Icon Navid Ahmed Shaikh
Navid Ahmed Shaikh
Vaibhav Kohli Vaibhav Kohli
Author Profile Icon Vaibhav Kohli
Vaibhav Kohli
Rajdeep Dua Rajdeep Dua
Author Profile Icon Rajdeep Dua
Rajdeep Dua
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Understanding Container Scenarios and an Overview of Docker FREE CHAPTER 2. Docker Installation 3. Building Base and Layered Images 4. Devising Microservices and N-Tier Applications 5. Moving Around Containerized Applications 6. Making Containers Work 7. Managing the Networking Stack of a Docker Container 8. Managing Docker Containers with Kubernetes 9. Hooking Volume Baggage 10. Docker Deployment in a Public Cloud - AWS and Azure

Kubernetes pod deployment


Now, in the following example, we will be deploying two NGINX replication pods (rc-pod) and exposing them via a service. To understand Kubernetes networking, please refer to the following diagram for more details. Here, an application can be exposed via a virtual IP address, and the request to be proxied, to which replica of pod (load balancer), is taken care of by the service:

Kubernetes networking with OVS bridge

  1. In the Kubernetes master, create a new folder:

    $ mkdir nginx_kube_example
    $ cd nginx_kube_example
    
  2. Create the YAML file in the editor of your choice, which will be used to deploy the NGINX pod:

    $ vi nginx_pod.yaml
    apiVersion: v1
    kind: ReplicationController
    metadata:
      name: nginx
    spec:
      replicas: 2
      selector:
        app: nginx
      template:
        metadata:
          name: nginx
          labels:
            app: nginx
      spec:
        containers:
        - name: nginx
          image: nginx
              ports:
              - containerPort: 80
    
  3. Create the NGINX pod using kubectl:

    $ kubectl...
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 $19.99/month. Cancel anytime
Banner background image