azure-container-networking/README.md

3.5 KiB

Overview

This repository contains plugins and tools for container networking in Azure:

  • A libnetwork (CNM) plugin for Docker containers on Microsoft Azure. The plugin connects containers to Azure's VNET, to take advantage of SDN capabilities.
  • A CNI plugin for Kubernetes and Mesos on Azure.

We welcome your feedback!

Setup

Download the latest official stable release from Docker plugin store.

$ docker plugin pull azure/azure-cnm-plugin

Build

If you want the very latest version, you can also build plugins directly from this repo.

Clone the azure-container-networking repo:

$ git clone https://github/com/Azure/azure-container-networking
$ cd azure-container-networking

Build the plugin for your environment. For Docker:

$ make azure-cnm-plugin

For Kubernetes and Mesos:

$ make azure-cni-plugin

The plugin is placed in the azure-container-networking/out directory.

Supported Environments

Microsoft Azure
Microsoft Azure Stack

Usage

Usage: azure-cnm-plugin [OPTIONS]

Options:
  -e, --environment={azure|mas}         Set the operating environment.
  -l, --log-level={info|debug}          Set the logging level.
  -t, --log-target={syslog|stderr}      Set the logging target.
  -?, --help                            Print usage and version information.

Examples

To connect your containers to other resources on your Azure virtual network, you need to first create a Docker network. A network is a group of uniquely addressable endpoints that can communicate with each other.

Create a network:

$ docker network create --driver=azurenet --ipam-driver=azureipam azure

When the command succeeds, it will return the network ID. Networks can also be listed by:

$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
3159b0528a83        azure               azurenet            local
515779dadc8a        bridge              bridge              local
ed6e704a74ef        host                host                local
b35e3b663cc1        none                null                local

Connect containers to your network by specifying the network name when starting them:

$ docker run --net=azure -it ubuntu:latest /bin/bash

Finally, once all containers on the network exit, you can delete the network:

$ docker network rm azure

All endpoints on the network must be deleted before the network itself can be deleted.

Topology

The plugin creates a bridge for each underlying Azure virtual network. The bridge functions in L2 mode and is bridged to the host network interface. The bridge itself can also be assigned an IP address, turning it into a gateway for containers.

If the container host VM has multiple network interfaces, the primary network interface is reserved for management traffic. A secondary interface is used for container traffic whenever possible.

Changelog

See CHANGELOG

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.