page_type | languages | products | description | urlFragment | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
Demo application for the 'Create a Deployment Pipeline with AKS and Github Actions' learn module |
aks-deployment-pipeline-github-actions-demo |
This is the base demonstration for the "Create a Deployment Pipeline with AKS and GitHub Actions" learn module.
Outline the file contents of the repository. It helps users navigate the codebase, build configuration and any related assets.
File/folder | Description |
---|---|
src |
Sample source code. |
.gitignore |
Define what to ignore at commit time. |
CHANGELOG.md |
List of changes to the sample. |
CONTRIBUTING.md |
Guidelines for contributing to the sample. |
README.md |
This README file. |
LICENSE |
The license for the sample. |
Dockerfile |
Docker image file |
This sample is built using Hugo, therefore it is needed as prerequisite to run this example.
Attention This section only applies if you're cloning the repository and running it in your local machine, it does not apply if you're trying to accomplish the related learn module.
In this case, please follow the module's instructions and run the startup script
After cloning the repository, init the theme repository by running git submodule update --init src/themes/introduction
in the root directory.
- Get into the
src
directory - Run
hugo server -D
- Access the URL given by the Terminal
Assuming you already have Docker installed, just run docker build -t image-name .
on the root directory.
To execute it, run: docker run -p <local-port>:80 image-name
You can also opt to run it from the remote source using docker run -p <local-port>:80 mcr.microsoft.com/mslearn/samples/contoso-website
Inside the Kubernetes directory, you'll have all necessary resources to deploy the application to an AKS cluster using the HTTP Application Routing Addon.
- Update the Ingress.yaml file and update your specific DNS zone to the one you have in your AKS cluster, this information can be found in the DNS zone resource inside the resource group of your cluster
- Use
Kubectl apply -f <filename>
to all the files in the directory to create the workloads
Hugo is a static build engine that allows users to create static websites. The idea behind this demo is to show how we can deploy a containerized application to AKS.
There's a Dockerfile in the root of the repository, this Dockerfile is responsible for generating the image we'll be using to deploy the website. It's a simple NGINX default image, in it we do a few steps:
- Update all the packages
- Install curl, git and Node.js
- Download and install Hugo
- Install PostCSS and autoprefixer using NPM globally as they are requirements for the theme
- Clone the repository and init all submodules
- Generate a static web page from the website template
- Move that directory into NGINX public folder
- Expose port 80 so we can access it from the cluster
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.
Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.
Privacy information can be found at https://privacy.microsoft.com/en-us/
Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.
- bash>
cd mslearn-aks-deployment-pipeline-github-actions
- bash>
./init.sh
output -> Resource Group Name: mslearn-gh-pipelines-1977 -> ACR Name: contosocontainerregistry26700 -> ACR Login Username: contosocontainerregistry26700 -> ACR Password: uJWyL8Jx=TxdXzVwu5Y8AxhOlz1WGiht -> AKS Cluster Name: contosocontainerregistry26700 -> AKS DNS Zone Name: 1f1d697eca204713895b.eastus.aksapp.io
- bash>
az group list -o table
- bash>
az acr list -o table
- bash>
az acr list --query "[?contains(resourceGroup, 'mslearn-gh-pipelines')].loginServer" -o table
- bash>
az acr credential show --name contosocontainerregistry26700 --query "username" -o table
- bash>
az acr credential show --name contosocontainerregistry26700 --query "passwords[0].value" -o table
- bash>
az acr repository list --name contosocontainerregistry26700 -o table
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
- bash>
git pull
- bash>
git tag -a v2.0.0 -m 'First tag'
- bash>
git push --tags
- bash>
az acr repository show-tags --repository contoso-website --name contosocontainerregistry26700 -o table
- bash>
helm version
- bash>
git pull origin main
- bash>
cd kubernetes/
- bash>
helm create contoso-website
- bash>
cd contoso-website/
- bash>
rm -rf charts/ templates/
- bash>
mkdir templates
- bash>
cd ../../
- bash>
cp -r ./kubernetes/ ./contoso-website/
- bash>
mv ../*.yaml ./templates
- bash>
git add .
- bash>
git commit -m "Add helm"
- bash>
git push -u origin main
- bash>
az aks list -o tsv --query "[?name=='contoso-video'].resourceGroup"
- bash>
az ad sp create-for-rbac --name "http://contoso.epsilonnet.gr" --role contributor --scopes /subscriptions/de8c9606-2f81-4ce0-9ad8-efd9feb7d97e/resourceGroups/mslearn-gh-pipelines-1977 --sdk-auth
mslearn-gh-pipelines-1977 --sdk-auth`
Retrying role assignment creation: 1/36
Retrying role assignment creation: 2/36
{
"clientId": "92f02e54-853a-4a50-9b70-62cd11490020",
"clientSecret": "99e6d8cf-738a-4ad2-833a-2902cc864149",
"subscriptionId": "de8c9606-2f81-4ce0-9ad8-efd9feb7d97e",
"tenantId": "54a6385f-8ade-4892-a404-d486b55a6746",
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
"resourceManagerEndpointUrl": "https://management.azure.com/",
"activeDirectoryGraphResourceId": "https://graph.windows.net/",
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
"galleryEndpointUrl": "https://gallery.azure.com/",
"managementEndpointUrl": "https://management.core.windows.net/"
}
- bash>
az aks show -g mslearn-gh-pipelines-1977 -n contoso-video -o tsv --query addonProfiles.httpApplicationRouting.config.HTTPApplicationRoutingZoneName
- bash>
git tag -a v2.0.1 -m "Creating first production deployment" && git push --tags