Skip to content

Commit cc7dcfa

Browse files
authored
Merge pull request #640 from slack/acs-quickstart
feat(azure): skeleton for Azure Container Service quickstart
2 parents 61c41c4 + 1fb84dc commit cc7dcfa

14 files changed

Lines changed: 344 additions & 0 deletions

File tree

mkdocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ pages:
1717
- Boot: quickstart/provider/gke/boot.md
1818
- DNS: quickstart/provider/gke/dns.md
1919
- Install Workflow: quickstart/provider/gke/install-gke.md
20+
- Azure:
21+
- Boot: quickstart/provider/azure-acs/boot.md
22+
- DNS: quickstart/provider/azure-acs/dns.md
23+
- Install Workflow: quickstart/provider/azure-acs/install-azure-acs.md
2024
- Vagrant:
2125
- Boot: quickstart/provider/vagrant/boot.md
2226
- DNS: quickstart/provider/vagrant/dns.md

src/quickstart/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Cloud-based options:
2121

2222
* [Google Container Engine](provider/gke/boot.md): provides a managed Kubernetes environment, available with a few clicks.
2323
* [Amazon Web Services](provider/aws/boot.md): uses Kubernetes upstream `kube-up.sh` to boot a cluster on AWS EC2.
24+
* [Azure Container Service](provider/azure-acs/boot.md): uses Azure Container Service to provision Kubernetes and install Workflow.
2425

2526
If you would like to test on your local machine follow, our guide for [Vagrant](provider/vagrant/boot.md).
2627

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# Booting Azure Container Service
2+
3+
## Prerequisites
4+
5+
1. Azure Account - An active Azure Cloud account is required for this quick start. Start a trial with $200 of free credit [here](https://azure.microsoft.com/en-us/free/). After completing trial sign up, a credit card for billing must be added, but will not be charged.
6+
7+
2. Some form of *nix-based terminal - MacOS, Ubuntu, CentOS, Bash on Windows, etc
8+
<br>Where the following is present:
9+
10+
3. Azure CLI - The Azure CLI (2.0) provides the `az` command which drives Azure through the command line. Install the CLI by following the instructions on [GitHub for the Azure CLI](https://github.com/Azure/azure-cli).
11+
12+
4. SSH Key - This is used to deploy the cluster. [This URL helps to create SSH keys compatible with Linux VMs on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys)
13+
14+
5. jq - to parse the JSON responses from the CLI. [jq download page](https://stedolan.github.io/jq/)
15+
16+
## Configure the Azure CLI
17+
18+
After installing the CLI, log in to an Azure Account by typing `az login`. Take the code offered, enter it into the text box at [https://aka.ms/devicelogin](https://aka.ms/devicelogin), and login using an Azure account which has ownership or contributor permissions over at least one subscription.
19+
20+
> Note: If the Azure subscription is configured for 2FA (not done by default), the Azure account used to login must have ownership credentials to create the service principal.
21+
22+
```
23+
$ az login
24+
To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code F7DLMNOPE to authenticate.
25+
[
26+
{
27+
"cloudName": "AzureCloud",
28+
"id": "57849302-a9f0-4908-b300-31337a0fb205",
29+
"isDefault": true,
30+
"name": "Azure Subscription",
31+
"state": "Enabled",
32+
"tenantId": "591acccc-dddd-4620-8f21-dbbeeeefee21",
33+
"user": {
34+
"name": "jhansen@deis.com",
35+
"type": "user"
36+
}
37+
}
38+
]
39+
```
40+
41+
The `id` field from the `az login` command is the Azure Subscription Id. This id will be used throughout the guide. As a matter of convenience, set an environment variable named `SUBSCRIPTION_ID` with the value of the id (e.g. 57849302-a9f0-4908-b300-31337a0fb205). Check the configuration by setting the active subscription with `az account set`:
42+
```
43+
$ export SUBSCRIPTION_ID=57849302-a9f0-4908-b300-31337a0fb205
44+
$ az account set --subscription="${SUBSCRIPTION_ID}"
45+
```
46+
47+
## Create an Azure Service Principal
48+
49+
Next, create an Azure Service Principal that will be used to provision the ACS Kubernetes Cluster. Service Principals are entities that have permission to create resources in an Azure Subscription. New Service Principals must be given a unique name, a role, and an Azure subscription that the Service Principal may modify.
50+
51+
```
52+
$ export SP_JSON=`az ad sp create-for-rbac -n="http://acsk8sdeis" --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}"`
53+
$ export SP_NAME=`echo $SP_JSON | jq -r '.name'`
54+
$ export SP_PASS=`echo $SP_JSON | jq -r '.password'`
55+
$ echo $SP_JSON
56+
```
57+
58+
This should display an output similar to this. `jq` has also automatically extracted these values for use in the creation of the cluster.
59+
```
60+
{
61+
"appId": "58b21231-3dd7-4546-bd37-9df88812331f",
62+
"name": "http://workflow-on-acs",
63+
"password": "349d4728-438a-52a5-ad25-a740aa0bd240",
64+
"tenant": "891a9ddc-477a-4620-8f21-db22ffd3ffea"
65+
}
66+
```
67+
68+
## Create an ACS Kubernetes Cluster
69+
70+
Azure supports two methods to build an ACS Kubernetes cluster, through the Azure Web Portal (UI) or using the Azure command line (CLI). Choose one of the two paths:
71+
72+
### Path 1: Azure 'az' CLI
73+
74+
Create an empty Azure resource group to hold the ACS Kubernetes cluster. The location of the resource group can be set to any available Azure datacenter. To see the possible locations run `az account list-locations --query [].name --output tsv`
75+
76+
Create an environment variable to hold the resource group name:
77+
78+
```
79+
$ export RG_NAME=myresourcegroup
80+
$ export DC_LOCATION=mylocation
81+
$ az group create --name "${RG_NAME}" --location "${DC_LOCATION}"
82+
```
83+
84+
Execute the command to deploy the cluster. The `dns-prefix` and `ssh-key-value` must be replaced with your own values.
85+
86+
```
87+
$ az acs create --resource-group="${RG_NAME}" --location="${DC_LOCATION}" \
88+
--service-principal="${SP_NAME}" \
89+
--client-secret="${SP_PASS}" \
90+
--orchestrator-type=kubernetes --master-count=1 --agent-count=2 \
91+
--agent-vm-size="Standard_D2_v2" \
92+
--admin-username="k8sadmin" \
93+
--name="k8sanddeis" --dns-prefix="mydnsprefix" \
94+
--ssh-key-value @/home/myusername/.ssh/id_rsa.pub
95+
```
96+
97+
> Note: When `az acs create` starts, the provisioning process runs entirely silent in the background. After a few minutes the `az` command should return with information about the deployment created as shown below.
98+
99+
```
100+
{
101+
"id": "/subscriptions/ed7cedf5-fcd8-4a5d-9980-96d838f65ab8/resourceGroups/myresourcegroup/providers/Microsoft.Resources/deployments/azurecli1481240849.890798",
102+
"name": "azurecli1481240849.890798",
103+
"properties": {
104+
"correlationId": "61be22d1-28d8-466c-a2ba-7bc11c2a3578",
105+
"debugSetting": null,
106+
"dependencies": [],
107+
"mode": "Incremental",
108+
"outputs": null,
109+
"parameters": null,
110+
"parametersLink": null,
111+
"providers": [
112+
{
113+
"id": null,
114+
"namespace": "Microsoft.ContainerService",
115+
...
116+
},
117+
"resourceGroup": "myresourcegroup"
118+
}
119+
```
120+
121+
### Path 2: UI
122+
123+
Sign into the [Azure Portal](https://portal.azure.com) and create a new Azure Container Service:
124+
125+
![](images/step1.png)
126+
127+
Select "Resource Manager" for the deployment model:
128+
129+
![](images/step2.png)
130+
131+
Provide basic settings for the new ACS Kubernetes cluster.
132+
133+
* User name: this is the unix user name that will be added to all master and worker nodes
134+
* SSH public key: provide a public key that will be associated with the user name specified above
135+
* Subscription: choose the Azure Subscription that will be charged for the compute resources
136+
* Resource group: create a new resource group and give the group a unique name
137+
* Location: choose an Azure location for the cluster
138+
139+
When the required information is filled out, click "Ok".
140+
141+
![](images/step3.png)
142+
143+
The next step takes the Service Principal name and password generated using the Azure CLI.
144+
145+
* Service Principal Client ID: the name of the principal created above e.g. `http://workflow-on-acs`
146+
* Service Principal Client Secret: the password returned by the Azure CLI e.g. 349d4728-438a-52a5-ad25-a740aa0bd240
147+
148+
![](images/step4.png)
149+
150+
Next, configure the number of worker nodes, the node size, and DNS prefix for the cluster.
151+
152+
Worker nodes should have at least 7GB of available RAM.
153+
154+
Click "Ok" to continue.
155+
156+
![](images/step5.png)
157+
158+
Review the cluster configuration and click "Ok". After clicking "Purchase" on the next screen the browser will be returned to the Azure Portal dashboard.
159+
160+
![](images/step6.png)
161+
162+
The Kubernetes cluster will take a few minutes to complete provisioning and configure itself. To monitor the progress of the deployment select the "Resource Group" from the nav on the left, then select the cluster name:
163+
164+
![](images/step8.png)
165+
166+
![](images/step9.png)
167+
168+
## Connect to the ACS Kubernetes Cluster
169+
170+
Retrieve the fully qualified domain name (FQDN) for the Kubernetes master.
171+
172+
```
173+
$ export K8S_FQDN=`az acs list -g $RG_NAME --query [0].masterProfile.fqdn --output tsv`
174+
$ echo $K8S_FQDN
175+
```
176+
177+
Download the Kubeconfig from the master to the local machine, make sure to use the same SSH credentials used to create the cluster:
178+
179+
```
180+
$ scp -i ~/.ssh/id_rsa k8sadmin@$K8S_FQDN:.kube/config ~/.kube/k8sanddeis.config
181+
The authenticity of host 'mydnsprefix.myregion.cloudapp.azure.com (40.78.71.181)' can't be established.
182+
ECDSA key fingerprint is a0:09:ff:59:83:47:70:38:d4:0d:68:b2:cf:0f:2a:cf.
183+
Are you sure you want to continue connecting (yes/no)? yes
184+
Warning: Permanently added 'mydnsprefix.myregion.cloudapp.azure.com,40.78.71.181' (ECDSA) to the list of known hosts.
185+
```
186+
187+
Point `kubectl` at the kubernetes configuration file by setting the `KUBECONFIG` environment value:
188+
189+
```
190+
export KUBECONFIG=~/.kube/k8sanddeis.config
191+
```
192+
193+
Verify connectivity to the new ACS Kubernetes cluster by running `kubectl cluster-info`
194+
195+
```
196+
$ kubectl cluster-info
197+
Kubernetes master is running at https://mydnsprefix.myregion.cloudapp.azure.com
198+
Heapster is running at https://mydnsprefix.myregion.cloudapp.azure.com/api/v1/proxy/namespaces/kube-system/services/heapster
199+
KubeDNS is running at https://mydnsprefix.myregion.cloudapp.azure.com/api/v1/proxy/namespaces/kube-system/services/kube-dns
200+
kubernetes-dashboard is running at https://mydnsprefix.myregion.cloudapp.azure.com/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard
201+
```
202+
203+
You are now ready to [install Deis Workflow](install-azure-acs.md)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Find the Load Balancer Address
2+
3+
On Azure Container Engine, Deis Workflow will automatically provision and
4+
attach a Azure Load Balancer to the router component. This component is
5+
responsible for routing HTTP and HTTPS requests from the public internet to
6+
applications that are deployed and managed by Deis Workflow.
7+
8+
Discover the ip address assigned to the `deis-router`, by describing the
9+
`deis-router` service:
10+
11+
```
12+
$ kubectl --namespace=deis get service deis-router
13+
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
14+
deis-router 10.0.60.172 13.82.148.57 80/TCP,443/TCP,2222/TCP,9090/TCP 54m
15+
```
16+
17+
If the `EXTERNAL-IP` column shows `<pending>` instead of an ip address continue
18+
to wait until Azure finishes provisioning and attaching the load balancer.
19+
20+
## Prepare the Hostname
21+
22+
Now that an ip address has been attached to the load balancer use the `nip.io`
23+
DNS service to route arbitrary hostnames to the Deis Workflow edge router.
24+
Usage of `nip.io` is not recommended for long-term use and is intended here as
25+
a short cut to prevent fiddling with DNS.
26+
27+
To verify connectivity to the Workflow API server and nip.io, construct the
28+
hostname by taking the ip address of load balancer and adding `nip.io`.
29+
30+
For our example above, the address would be: `13.82.148.57.nip.io`.
31+
32+
Nip answers with the ip address no matter the hostname:
33+
```
34+
$ host 13.82.148.57.nip.io
35+
13.82.148.57.nip.io has address 13.82.148.57
36+
$ host something-random.13.82.148.57.nip.io
37+
something-random.13.82.148.57.nip.io has address 13.82.148.57
38+
```
39+
40+
By default, any HTTP traffic destined for the hostname `deis` is automatically sent to the Workflow API service. To test that everything is connected properly use `curl`:
41+
42+
```
43+
$ curl http://deis.13.82.148.57.nip.io/v2/ && echo
44+
{"detail":"Authentication credentials were not provided."}
45+
```
46+
47+
Since no authentication information has been provided, `curl` will return an error. However this does validate that `curl` has reached the Workflow API service.
48+
49+
Remember the hostname, it will used in the next step.
50+
51+
You are now ready to [register an admin user and deploy your first app](../../deploy-an-app.md).
159 KB
Loading
148 KB
Loading
102 KB
Loading
89 KB
Loading
75.3 KB
Loading
97.4 KB
Loading

0 commit comments

Comments
 (0)