Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
1. Update README.md
2. Add script assignFQDNtoIP.sh to bind IP to host name
  • Loading branch information
chadliuxc committed Mar 20, 2018
1 parent 863b14b commit 690c0e8
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 28 deletions.
81 changes: 54 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,69 +7,96 @@ Contact ria.bhatia@microsoft.com if you need help!

steps to deploy dis demo & talking tips

Part 1
create resource group
Part 0 Prerequisites
In order to run this demo, you will need the following:

- An active [Microsoft Azure](https://azure.microsoft.com/en-us/free "Microsoft Azure") Subscription
- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/overview?view=azure-cli-latest "Azure CLI") installed
- [Kubernetes CLI (kubectl)](https://kubernetes.io/docs/tasks/tools/install-kubectl/ "Kubernetes CLI (kubectl)") installed
- [Helm client](https://docs.helm.sh/using_helm/#installing-helm) installed

Part 1 Setup
Replace `<myResourceGroup>` with your expected and run following command to create resource group. Then remember the created resource group name.
```
$ az group create --name myResourceGroup --location westus2
$ az group create --name <myResourceGroup> --location eastus
```

deploy aks kub cluster
> **Note:** The AKS extending to ACI only support in one location. So far AKS and ACI are both deployed to East US and West Europe. So please create your resource group in East US or West Europe only.
Replace `<myResourceGroup>`,`<myK8sCluster>` with your expected and run following command to create the AKS. Then remember the AKS name.
```
$ az aks create --resource-group myResourceGroup --name myK8sCluster --node-count 1 --generate-ssh-keys
$ az aks create --resource-group <myResourceGroup> --name <myK8sCluster> --node-count 1 --generate-ssh-keys
```

get creds
Replace `<myResourceGroup>`, `<myK8sCluster>` with your created in previous steps and run following command to set the AKS as your current connected cluster.
```
$ az aks get-credentials --resource-group=myResourceGroup --name=myK8sCluster
$ az aks get-credentials --resource-group <myResourceGroup> --name <myK8sCluster>
```

make sure you're connected
Make sure you're connected.
```
$ kubectl get nodes
```

clone this repo
Make sure you have helm installed and initialize this.
```
$ git clone https://github.com/rbitia/aci-demos.git
$ helm init
```

Make sure you have helm installed and initialize this
Replace `<your email>` with yours and run to install kube-lego w/ helm for certs.

```
$ helm init
$ helm install stable/kube-lego --name kube-lego --namespace kube-system --set config.LEGO_EMAIL=<your email>,config.LEGO_URL=https://acme-v01.api.letsencrypt.org/directory
```
edit the values.yaml file and replace <your name> with your own hosted domain

Install ingress controller w/ helm.
```
$ cd aci-demos/charts/fr-demo/
$ vim values.yaml
$ helm install stable/nginx-ingress --name ingress --namespace kube-system
```

Get the Public IP of the ingress controller. It may take some times for the IP assigned to the services
```
$ kubectl get services --namespace kube-system --watch
```

install kube-lego w/ helm for certs
When the IP assigned, remember the IP address and press Ctrl+Q to exit

Clone this repo
```
helm install stable/kube-lego --name kube-lego --namespace kube-system --set config.LEGO_EMAIL=<your email>,config.LEGO_URL=https://acme-v01.api.letsencrypt.org/directory
$ git clone https://github.com/rbitia/aci-demos.git
```

Change the folder to the root of the source code
```
$ cd aci-demo
```

install ingress controller w/ helm
```
helm install stable/nginx-ingress --name ingress --namespace kube-system
```
^set up can be done before you demo
Make sure to grab the Public IP of the ingress controller and place it into your dns zone registration record set.
Replace `<myResourceGroup>`, `<IP Address>` with your created in previous steps. Replace `<appName>` with your expected and run following shell script to bind FQDN to your IP. Remember the return name. You will use it to access the web application later.
```
$ assignFQDNtoIP.sh -g <myResourceGroup> -d <appName> -i <IP Address>
```

Edit the values.yaml file and replace all `<host name>` with the FQDN name in pervious step.
```
$ cd aci-demos/charts/fr-demo/
$ vim values.yaml
```

Start at the top of the aci-demos directory and deploy the Facial Recognition application that consists of a frontend, a backend, and a set of image recognizers.

```
$ helm install charts/fr-demo --name demo
```

Checkout the UI that's generated in the output and see the pictures start to get processed
Right now you first need to reset the demo at fr-backend.<your domain>
Now checkout the UI which is usually at fr.<your domain>
The rate will be super slow because we have a 1 node AKS cluster running 2 pods.
The rate will be super slow because we have a 1 node AKS cluster running 1 worker pod.

Deploy the ACI connector :
Replace `<myResourceGroupmy>`, `<myK8sCluster>` with yours in previous steps and run following command
```
az aks install-connector --resource-group myResourceGroup --name myK8sCluster --connector-name myaciconnector
az aks install-connector --resource-group <myResourceGroup> --name <myK8sCluster> --connector-name myaciconnector
```

The connector has been deployed and with a `kubectl get nodes` you can see that the ACI Connector is a new node in your cluster. Now scale up the image recognizer to 10 using the following command
Expand Down
31 changes: 31 additions & 0 deletions assignFQDNtoIP.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

while getopts "g:d:i:" opt; do
case $opt in
g)
echo "Resource Group is $OPTARG"
RESOURCEGROUP=$OPTARG
;;
d)
echo "DNS name is $OPTARG"
DNSNAME=$OPTARG
;;
i)
echo "IP is $OPTARG"
IP=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG"
;;
esac
done

# Get resource group and public ip name
RESOURCEGROUP=$(az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[resourceGroup]" --output tsv)
PIPNAME=$(az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[name]" --output tsv)

# Update public ip address with dns name
echo "Start assigning domain name to IP $IP..."
az network public-ip update --resource-group $RESOURCEGROUP --name $PIPNAME --dns-name $DNSNAME >/dev/null

az network public-ip list --query "[?ipAddress=='$IP']|[0].dnsSettings.fqdn"
2 changes: 1 addition & 1 deletion charts/fr-demo/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
1. Get the application URL by running these commands:
{{- if .Values.frontend.ingress.enabled }}
{{- range .Values.frontend.ingress.hosts }}
http://{{ . }}
https://{{ . }}
{{- end }}
{{- else if contains "NodePort" .Values.frontend.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}-frontend)
Expand Down

0 comments on commit 690c0e8

Please sign in to comment.