Code Monkey home page Code Monkey logo

aks-rcs's Introduction

AKS-RCS

The repo contains a Bicep module that deploys 2 AKS Clusters and prerequesite resources. A sample workload (Docker image, pushed to ACR) is then deployed into the Clusters in 2 seperate regions. (uksouth & northeurope)

Each cluster has an Application Gateway and Public IP ingress. There is the addition of a Globally redundant LB (FrontDoor) for directing traffic to either of the 2 App Gateways.

There are 3 RBAC Assignments to manage the clusters and ACR container image. (Currently the Service principal will need to be created manually and given the Contributor role scoped to target RG)

An Azure Function App is also deployed containing 2 PowerShell scripts via the "azure-deploy.yaml" workflow. These scripts are ran on a schedule which is defined in the Function App resouce block.

Get-PreferredLocation.ps1 will querry the "National Grid ESO - Carbon Intensity API" and return values that will influence Cluster configuration via passing returned variable from Update-AKS.ps1 script and interacting with the clusters with Azure CLI. The clusters should shutdown/auto-scale based on the return parameter from Get-PrefferdLocation and traffic should be pointed towards the favourable CI region. There should be no interruption to live sessions on the workload.

The deployment is run via Github Actions.

This repo is a work in progress - Function App & FrontDoor components need finalized and tested.

Notes

AKS (Azure Container Service) - is only currently offered in UK South and you are also unable to scale down to zero pods. The KEDA project builds on top of HPA and adds support for scale to zero. So workloads can be stopped when the carbon intensity is too high. https://github.com/Azure/carbon-aware-keda-operator

Deploy manually from VS*

  • az deployment group create --resource-group AKS-RCS --template-file main.bicep --parameters main.bicepparam

When Bicep infrastructure is deployed. Publish Function App

  • cd Scripts/PS1

  • func azure functionapp publish AKS-RCS-FunctionApp --force

Further reading

https://carbonintensity.org.uk https://learn.greensoftware.foundation/carbon-awareness/#demand-shifting https://ceur-ws.org/Vol-2382/ICT4S2019_paper_28.pdf https://devblogs.microsoft.com/sustainable-software/carbon-aware-kubernetes https://devblogs.microsoft.com/ise/saving-co2-using-location-and-time-shifting-in-azure https://devblogs.microsoft.com/sustainable-software/how-can-i-calculate-co2eq-emissions-for-my-azure-vm

aks-rcs's People

Contributors

jmcdknos avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.