Book Image

Troubleshooting Docker

By : Vaibhav Kohli, Rajdeep Dua, John Wooten
Book Image

Troubleshooting Docker

By: Vaibhav Kohli, Rajdeep Dua, John Wooten

Overview of this book

You?re pro Docker? You?ve read all about orchestration with Docker in books? Now learn how to troubleshoot Docker in practice. Gain all the tools to safely see Docker in action with this 2017 book.
Table of Contents (17 chapters)
Troubleshooting Docker
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
1
Understanding Container Scenarios and an Overview of Docker

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...