Skip to content

Run Custom Image in AKS

Sometimes you might want to run a custom image in (stage) AKS, to test something not easily testable locally that you do not want to commit or make a normal release of. In such cases its possible to run a locally built custom docker image of a service.

Notes

  • Since this replace the currently deployed image, make sure to not break stage testing for anyone else!
  • Remember to change back as soon as possible to minimize the risk of breaking something (Like regr-tests, smoketests or apps testing)
  • If a PR is merged or the deployment pipeline is triggered, it will overwrite your changes back to the "normal" image.

Steps

This guide will use User.Api as example, but the same technique should work everywhere.

  1. Get latest master of Area.
  2. In Visual Studio, Do the modifications you want to include (for example add a new endpoint).
  3. In Visual Studio, Build and Publish to a folder (i.e. be-user\Minority\Minority.User\Minority.User.Api\bin\Release\net8.0\publish).
  4. From command line, build and push docker image:
    > cd be-user\Minority\Minority.User\Minority.User.Api\bin\Release\net8.0\publish
    > az acr login -n minoritycr.azurecr.io
    > docker build . -f ..\..\..\..\Dockerfile -t myname-user-api:1
    > docker tag  myname-user-api:1 minoritycr.azurecr.io/myname-user-api:1
    > docker push minoritycr.azurecr.io/myname-user-api:1
    
  5. Go to stage ArgoCD and find the deployment.
  6. Edit the deployment yaml so it uses your new image. (e.g. image: minoritycr.azurecr.io/minority-user-api:v2-25.0429.109 -> image: minoritycr.azurecr.io/myname-user-api:1). To easily change back copy the old value.
  7. After saving, make sure that the updated deployment worked and a new pod was started correctly. If not change back.