Difference between revisions of "Ingress with the wildcard ssl certificate of Lets Encrypt on AKS"

From ESS-WIKI
Jump to: navigation, search
 
(51 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Prerequisite ==
+
== Prerequisites ==
  
1. Have an Azure DNS Zone and delegate your domain name into it. (refer to [https://docs.microsoft.com/en-us/azure/dns/dns-delegate-domain-azure-dns Host your domain in Azure DNS])
+
    1. Have an Azure DNS Zone and delegate your domain name to it. (please refer to [https://docs.microsoft.com/en-us/azure/dns/dns-delegate-domain-azure-dns Host your domain in Azure DNS])
  
2. Have an AKS and note its Name('''$AKS_NAME''') and Recource Group('''$AKS_RESOURCE_GROUP''').
+
    2. Have an AKS and make sure it's Linux-based.
 +
 
 +
&nbsp; &nbsp; 3. Note down the&nbsp;<u>'''name'''</u>('''$AKS_NAME''') and <u>'''resource group'''</u>('''$AKS_RESOURCE_GROUP''') of the AKS.
 +
 
 +
&nbsp; &nbsp; 4. Make sure that there are no other installed instances of the ingress and the cert-manager.
  
 
== First thing on Azure ==
 
== First thing on Azure ==
  
1. Please refer to [https://docs.microsoft.com/en-us/azure/cloud-shell/quickstart Quickstart for Bash in Azure Cloud Shell] and enter the azure bash.
+
&nbsp; &nbsp; 1. Please refer to [https://docs.microsoft.com/en-us/azure/cloud-shell/quickstart Quickstart for Bash in Azure Cloud Shell] and '''enter the azure bash'''.
 +
 
 +
&nbsp; &nbsp; 2. Show you account information by using "'''az account show'''" and note down your <u>'''subscription id'''</u>('''$SUBSCRIPTION_ID''') and <u>'''tenant id'''</u>('''$TENANT_ID''') be shown as the following picture.
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;[[File:Aks wsc le ids.png|Subscription Id and Tenant Id]]
 +
 
 +
&nbsp; &nbsp; 3. Use "az aks get-credentials --resource-group '''$AKS_RESOURCE_GROUP''' --name '''$AKS_NAME'''" to get the access right of '''kubectl'''.
 +
 
 +
&nbsp; &nbsp; 4. Make sure that you have the ability&nbsp;to install packages with helm. If not, please refer to [https://docs.microsoft.com/en-us/azure/aks/kubernetes-helm Install applications with Helm in Azure Kubernetes Service (AKS)]
 +
 
 +
== Upload and Install ==
 +
 
 +
&nbsp; &nbsp; 1. Download [[File:AKSLE.zip|AKSLE]].
 +
 
 +
&nbsp; &nbsp; 2. Unzip it and upload AKSLE.sh as the following picture.
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;[[File:Upload to aks.png|Upload]]
 +
 
 +
&nbsp; &nbsp; 3. Change the file mode by using "chmod 777 AKSLE.sh"
 +
 
 +
&nbsp; &nbsp; 4. Install it and it will generate a file '''"route.yaml"''' by using 'AKSLE.sh&nbsp; &nbsp;'''$DOMAIN_NAME'''&nbsp; &nbsp;'''$ADMIN_EMAIL_ADDRESS'''&nbsp; &nbsp;'''$SUBSCRIPTION_ID'''&nbsp; &nbsp;'''$TENANT_ID''''
 +
 
 +
    <span style="font-size:large;">'''Example''': 'AKSLE.sh "edgecenter.io" "fred.chang@advantech.com.tw" "12345679-1234-1234-1234-123456789012" "abcdefgh-abcd-abcd-abcd-abcdefghijkl"'</span>
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="font-size:xx-small;">P.S. If you have an azure public IP interface for ingress, you can use 'AKSLE.sh '''$DOMAIN_NAME''' '''$ADMIN_EMAIL_ADDRESS''' '''$SUBSCRIPTION_ID''' '''$TENANT_ID''' '''<span style="color:#FF0000;">$PUBLIC_IP</span>''''</span>
 +
 
 +
&nbsp; &nbsp; 5. Show '''EXTERNAL-IP''' by using 'kubectl get service/nginx-ingress-controller' and update it on Azure DNS zone.
 +
 
 +
== Configuration ==
 +
 
 +
*You can modify the file '''"route.yaml"''' as the following picture to fit your scenario, and apply it by using '''"kubectl apply -f route.yaml"'''.
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;[[File:Route.png|Route]]
 +
 
 +
*You need to update the related records on&nbsp;Azure DNS zone.
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;[[File:Dnszone.png|DNS Zone]]
 +
 
 +
== Production version ==
 +
 
 +
Above example is for testing, and the certificate is fake and untrusted.
 +
 
 +
&nbsp;&nbsp;[[File:Fake.png|Fake]]
 +
 
 +
If you are ready to deploy a real certificate and the result of the above test is well, you can run the production procedure.
  
2. Show you account information by typing "'''az account show'''" and note your <u>'''subscription id'''</u>('''$SUBSCRIPTION_ID''') and <u>'''tenant id'''</u>('''$TENANT_ID''') be showed as the following picture.
+
The production procedure is just
  
      [[File:Aks wsc le ids.png|RTENOTITLE]]
+
#Use [[File:Delete.zip|Delete]]&nbsp;with&nbsp;the command './delete.sh $DOMAIN_NAME'
 +
#Use [[File:AKSLE-prod.zip|Production]] with the same flow of the test procedure.
  
3. Use "az aks get-credentials --resource-group '''$AKS_RESOURCE_GROUP''' --name '''$AKS_NAME'''" to get the access right of '''kubectl'''.
+
And then you will get
  
4. Ensure you have the capability to install packages with helm. If not, please refer to [https://docs.microsoft.com/en-us/azure/aks/kubernetes-helm Install applications with Helm in Azure Kubernetes Service (AKS)]
+
&nbsp;&nbsp;[[File:Production.png|Production]]

Latest revision as of 11:28, 12 July 2019

Prerequisites

    1. Have an Azure DNS Zone and delegate your domain name to it. (please refer to Host your domain in Azure DNS)

    2. Have an AKS and make sure it's Linux-based.

    3. Note down the name($AKS_NAME) and resource group($AKS_RESOURCE_GROUP) of the AKS.

    4. Make sure that there are no other installed instances of the ingress and the cert-manager.

First thing on Azure

    1. Please refer to Quickstart for Bash in Azure Cloud Shell and enter the azure bash.

    2. Show you account information by using "az account show" and note down your subscription id($SUBSCRIPTION_ID) and tenant id($TENANT_ID) be shown as the following picture.

        Subscription Id and Tenant Id

    3. Use "az aks get-credentials --resource-group $AKS_RESOURCE_GROUP --name $AKS_NAME" to get the access right of kubectl.

    4. Make sure that you have the ability to install packages with helm. If not, please refer to Install applications with Helm in Azure Kubernetes Service (AKS)

Upload and Install

    1. Download File:AKSLE.zip.

    2. Unzip it and upload AKSLE.sh as the following picture.

        Upload

    3. Change the file mode by using "chmod 777 AKSLE.sh"

    4. Install it and it will generate a file "route.yaml" by using 'AKSLE.sh   $DOMAIN_NAME   $ADMIN_EMAIL_ADDRESS   $SUBSCRIPTION_ID   $TENANT_ID'

   Example: 'AKSLE.sh "edgecenter.io" "fred.chang@advantech.com.tw" "12345679-1234-1234-1234-123456789012" "abcdefgh-abcd-abcd-abcd-abcdefghijkl"'

          P.S. If you have an azure public IP interface for ingress, you can use 'AKSLE.sh $DOMAIN_NAME $ADMIN_EMAIL_ADDRESS $SUBSCRIPTION_ID $TENANT_ID $PUBLIC_IP'

    5. Show EXTERNAL-IP by using 'kubectl get service/nginx-ingress-controller' and update it on Azure DNS zone.

Configuration

  • You can modify the file "route.yaml" as the following picture to fit your scenario, and apply it by using "kubectl apply -f route.yaml".

            Route

  • You need to update the related records on Azure DNS zone.

            DNS Zone

Production version

Above example is for testing, and the certificate is fake and untrusted.

  Fake

If you are ready to deploy a real certificate and the result of the above test is well, you can run the production procedure.

The production procedure is just

  1. Use File:Delete.zip with the command './delete.sh $DOMAIN_NAME'
  2. Use File:AKSLE-prod.zip with the same flow of the test procedure.

And then you will get

  Production