Skip to content

MicrosoftDocs/mslearn-aks-deploy-container-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

page_type languages products description urlFragment
sample
go
javascript
html
css
aks
Demo application for the 'Creating an AKS application' learn module
deploy-container-app-aks-demo

Official Microsoft Sample

This is the base demonstration for the "Deploying a containerized application in AKS" learn module.

Summary

Contents

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

Prerequisites

This sample is built using Hugo, therefore it is needed as prerequisite to run this example.

Setup

After cloning the repository, init the theme repository by running git submodule update --init src/themes/introduction in the root directory.

Running the sample

  1. Get into the src directory
  2. Run hugo server -D
  3. Access the URL given by the Terminal

Running the image

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

Deploying to Kubernetes

Inside the Kubernetes directory, you'll have all necessary resources to deploy the application to an AKS cluster using the HTTP Application Routing Addon.

  1. 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
  2. Use Kubectl apply -f <filename> to all the files in the directory to create the workloads

Key concepts

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

Contributing

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 [email protected] with any additional questions or comments.

About

Sample code for the Deploy a containerized application on Azure Kubernetes Service Microsoft Learn module

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •