In one of my previous posts i described Kubernetes Azure cluster, in this one we’ll create Swarm container.
As i already described in Kubernetes post, we need to create public/private key, so i won’t go into much details here,we need to use PuTTy generator, save private key also.
New-Containers-Azure-Container Service
Copy public key from PuTTy generator, specify username
Agent count: For Docker Swarm and Kubernetes, this value is the initial number of agents in the agent scale set. For DC/OS, it is the initial number of agents in a private scale set. Additionally, a public scale set is created for DC/OS, which contains a predetermined number of agents. The number of agents in this public scale set is determined by the number of masters in the cluster: one public agent for one master, and two public agents for three or five masters
After Cluster is installed, we need to get public DNS name, on cluster properties click Overview
In PuTTY specify this name and port 2200
and specify private key saved in same step when creating public key
Check Swarm agent configuration:
docker -H 172.16.0.5:2375 info
root@swarm-master-BBDA4078-0:/home/ja# docker -H 172.16.0.5:2375 info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Role: primary
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 2
swarm-agent-BBDA4078000000: 10.0.0.4:2375
└ Status: Healthy
└ Containers: 0
└ Reserved CPUs: 0 / 2
└ Reserved Memory: 0 B / 4.036 GiB
└ Labels: executiondriver=, kernelversion=3.19.0-65-generic, operatingsystem=Ubuntu 14.04.4 LTS, storagedriver=overlay
└ Error: (none)
└ UpdatedAt: 2017-11-16T19:45:33Z
swarm-agent-BBDA4078000001: 10.0.0.5:2375
└ Status: Healthy
└ Containers: 0
└ Reserved CPUs: 0 / 2
└ Reserved Memory: 0 B / 4.036 GiB
└ Labels: executiondriver=, kernelversion=3.19.0-65-generic, operatingsystem=Ubuntu 14.04.4 LTS, storagedriver=overlay
└ Error: (none)
└ UpdatedAt: 2017-11-16T19:45:37Z
Plugins:
Volume:
Network:
Log:
Swarm:
NodeID:
Is Manager: false
Node Address:
Kernel Version: 3.19.0-65-generic
Operating System: linux
Architecture: amd64
CPUs: 4
Total Memory: 8.073GiB
Name: 23325e0bd3f7
Docker Root Dir:
Debug Mode (client): false
Debug Mode (server): false
Experimental: false
Live Restore Enabled: false
WARNING: No kernel memory limit support
To avoid specifying target socket (172.16.0.5:2375) every time we’ll set environmental variable
export DOCKER_HOST=172.16.0.5:2375
Deploy web server:
docker run -d -p 80:80 nginx
Browse Swarm agent’s Public DNS,it will be used as connection point to our nginx container,in Swarm Cluster properties click on agents,copy public DNS
And use it for connection to container