page_type | languages | products | description | |||
---|---|---|---|---|---|---|
sample |
|
|
This sample creates a multi-container application in an Azure Kubernetes Service (AKS) cluster. |
This demo is a cloned from the GitHub Demo Day sessions hosted on Sep 10, 2021!
We will use this repo to see how GitHub can simplify security, automation, container management, K8s deployments and more!
-
Create the Azure K8S Cluster in Azure in a resource group. Generate the SP Creds using the below suggestion
-
This demo requires 4 secrets to be generated:
Secret Name | Value Required |
---|---|
AKS_CLUSTER_NAME | AKS Cluster name |
AKS_CLUSTER_RESOURCE_GROUP | Resource Group that contains the AKS Cluster |
AZURE_SERVICE_PROVIDER_CREDENTIALS | SP with permission to access the Azure Resource Group |
GH_ENV_PAT | PAT with repo admin access |
- If you'd like to try this out yourself, ensure that the following files have been modified to represent your repository. Replace references to OWNER/REPO-NAME to your repo.
docker-compose.yaml
anddeployment.yml
To deploy to Azure you will need to create a service principal. You can do that with the following command:
az ad sp create-for-rbac --name {yourServicePrincipalName} --role contributor \
--scopes /subscriptions/{subscription-id} \
--sdk-auth
# Replace {yourServicePrincipalName}, {subscription-id} with the a service principal name and subscription id.
# The command should output a JSON object similar to the example below
{
"clientId": "<GUID>",
"clientSecret": "<GUID>",
"subscriptionId": "<GUID>",
"tenantId": "<GUID>",
(...)
}
- Open project in Codespaces or VS Code
- Use
docker-compose build
anddocker-compose up
commands to show off the application - Create a new branch,
- modify
azure-vote/azure-vote/config_file.cfg
to update homepage values
- modify
- Create a PR, utilize review-lab keyword comment - if desired.
- Show AKS Cluster to demonstrate any namespace updates/changes.
- Merge PR, observe that Cleanup PR and AKS Staging & Production - Deploy workflows kick off
- View Staging and Production environment deployments
This sample creates a multi-container application in an Azure Kubernetes Service (AKS) cluster. The application interface has been built using Python / Flask. The data component is using Redis.
To walk through a quick deployment of this application, see the AKS quick start.
To walk through a complete experience where this code is packaged into container images, uploaded to Azure Container Registry, and then run in and AKS cluster, see the AKS tutorials.
Currently the manifests/deployment.yml
file needs to have the azure-vote-front
image value updated to match your repository.
For demo purposes, the manifest files only ask for 1 replica for the services. Multiple replicas or namespaces (5+) may hit resource limitations for your AKS cluster.
GitHub is the world's leading software development platform. Microsoft Teams is one of the most popular communication platforms where modern development teams come together to build world-class products and services. With two of your most important workspaces connected, you'll stay updated on what's happening on GitHub without leaving Microsoft Teams.
Environments - You can configure environments with protection rules and secrets. When a workflow job references an environment, the job won't start until all of the environment's protection rules pass.
You can store and manage Docker and OCI images in the Container registry, which uses the package namespace https://ghcr.io.