Container technology is currently a very popular technology, especially driven by the use of docker as a container engine, so that containers are lightweight, portable, and self-contained, isolation has taken a new step. Currently, when talking about Dev/OPS, Ci/CD rarely bypasses docker.
Azure launched the container service ACS last year. It is well received for its comprehensive compatibility, openness, and comprehensive orchestration tool (DC/OS, kubernetes, and swarm) for open source, however, ACS is not available in China and many regions. How to quickly deploy container services in these regions is always a problem.
Microsoft went further. In the early November S, it further opened up ACs-engine, the Core Engine of ACS, developers can use ACs-engine to quickly generate arm templates that can be deployed in all regions, including China, without relying on ACS container resource provider, this is a good news for developers and maintenance personnel. I don't have to work hard to debug and modify scripts and arm templates to deploy DC/OS clusters in azure China like me :)
News: http://www.forbes.com/sites/janakirammsv/2016/11/07/microsoft-open-sources-azure-container-service-adds-support-for-kubernetes/#48e955d270ad
ACS-engine official address: https://github.com/Azure/acs-engine
Many cool people have already written some amazing ACs-engine articles. This article is based on my actual tests and records some problems and solutions, I hope this will be helpful for quick deployment.
First, let's take a brief look at the deployment architecture of the DC/OS cluster. We have a master high availability set, and the master can choose 1, 3, and 5 virtual machines; there is a public agent VMSs set that is mainly used to deploy applications that are accessible to Internet users. A private agent's VMSs cannot be accessed through the public network and runs some default calculations:
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183317737-413251303.png "style =" border: 0px; "/>
Install and configure ACs-engine
Download the installation package suitable for your operating system on the go language Official website. For example, download and install the go language package in Ubuntu:
Wget https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
Address: https://golang.org/dl/
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183318565-1377667712.png "style =" border: 0px; "/>
In Linux, create a sub-directory gopath under your user directory and add the following lines to your $ home/. profile file:
Export Path = $ path:/usr/local/go/bin
Export gopath = $ home/gopath
Go to your gopath directory, download ACs-engine, and update related components:
Go get github.com/azure/acs-engine
Go get all
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183319440-267170449.png "style =" border: 0px; "/>
Open dcosprovision under parts. sh file, you can see that many packages need to be downloaded from abroad, due to GFW, your installation will become very slow, or fail, first download the following package to your local server, create an image:
From the following address:
Https://dcosio.azureedge.net/dcos/testing/bootstrap
Https://az837203.vo.msecnd.net/dcos-deps
Download the following package to your china backup storage:
5b4aa436101_ee1d60b4aa0751a1fb751_c083.bootstrap.tar. xz (about 551 m)
Docker-engine_1.11.2-0 ~ Xenial_amd64.deb
Ipset_6.29-1_amd64.deb
Libipset3_6.29-1_amd64.deb
Libltdl7_2.4.6-0.1_amd64.deb
Unzip_6.0-20ubuntu1_amd64.deb
Go to your ACs-engine root directory and build your ACs-engine:
CD $ gopath/src/github.com/azure/acs-engine
Go build
./ACs-engine
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183320440-1319759096.png "style =" border: 0px; "/>
As you can see, if you want to generate a JSON template, you need a clusterdefinitionfile. There are various example files in example. Take DCOs as an example. You can see that edit example/DCOs. JSON, modify the following red section and save it:
"Masterprofile ":{
"Count": 1,
"Dnsprefix": "dcosmaterdemo ",
"Vmsize": "standard_d2"
},
{
"Name": "agentpublic ",
"Count": 3,
"Vmsize": "standard_d2 ",
"Dnsprefix": "dcosagentdemo ",
"Ports ":[
80,
443,
8080
]
}
"Publickeys ":[
{
"Keydata": "yourkey"
}
]
Run ACs-engine to generate your arm Template
./ACs-engine examples/DCOs. JSON
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183321096-1038169927.png "style =" border: 0px; "/>
This step is very important. You need to manually open the generated azuredeploy. JSON file and modify the following CDN download source to your china image address. Otherwise, your deployment will fail:
Https://dcosio.azureedge.net/dcos/testing/bootstrap
Https://az837203.vo.msecnd.net/dcos-deps
The rest is easier. Use azure CLI to deploy your DC/OS cluster:
# Log on to Azure in China using azure CLI:
Azure login-u username-P password-e azurechinacloud
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183321737-1548629995.png "style =" border: 0px; "/>
# Create a resource group:
Azure group create -- name = "Steven acsdcosgp" -- location = "China East"
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183322471-810364723.png "style =" border: 0px; "/>
# Execute deployment:
Azure group deployment create -- name = "mydcoschinadeploy" -- Resource-group = "Steven acsdcosgp" -- template-file = ". /_ output/DCOS184-10726092/azuredeploy. JSON "-- parameters-file = ". /_ output/DCOS184-10726092/azuredeploy. parameters. JSON"
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183323784-1718726455.png "style =" border: 0px; "/>
After the deployment is complete, you can view the successful deployment information in the new portal. In my actual environment, the deployment process only requires more than eight points, please record the Master Address highlighted in Yellow:
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183325018-1845462505.png "style =" border: 0px; "/>
Then we need to connect to the DC/OS cluster, use the master1_dn address, port is 2200, use your private key file (PPK file), establish tunnel port is 80, and connect:
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183325675-1488088296.png "style =" border: 0px; "/>
Auth Configuration:
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183326284-345894612.png "style =" border: 0px; "/>
Tunnel Configuration:
After the connection, open your browser, enter http: // localhost/, and you will see the following DC/OS dashboard. Then you can enjoy playing with docker, DC/OS:
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183326971-466510731.png "style =" border: 0px; "/>
TIPS: If you happen to be unfortunately unable to connect When configuring the SSH tunnel, check the putty Event Log and see the Permission denied error. I have found a solution to save your time, follow these steps:
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183327518-256468229.png "style =" border: 0px; "/>
Check netstat-Aon | findstr "80"
Some services use ntoskrnl to occupy port 80. For example, WS-management causes local tunnel failure:
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183328206-1417107384.png "style =" border: 0px; "/>
Net stop HTTP
650) This. width = 650; "src =" http://images2015.cnblogs.com/blog/845013/201611/845013-20161122183328987-1441706032.png "style =" border: 0px; "/>
From the above documents, we can see that using ACs-engine can easily generate an arm template for large-scale deployment of azure in China, but with this template, you can simply modify the parameters, you can re-deploy the service. You don't need to generate it every time. So I have put the generated template on GitHub and want to deploy it in China:
Https://github.com/kingliantop/azurelabs/tree/master/AzureChinaARMTemplate/mesos-marathon-vmss-china
Clone or download all current files
Modify http: // yourchinaserver in azuredeploy. JSON for your own server,
Modify all places marked as changit in azuredeploy. Parameters. JSON.
Modify deployname in the deploy. PS1 file as your resource group name
Log on to your azure account and run deploy. PS1 in arm mode.
Linux and Mac users can also use azure CLI for deployment.
Use arm templates to deploy DC/OS clusters on a large scale in azure China