I have an Azure ContainerApp deployed with a single revision, and I'd like to stop it - but not delete it and have to re-deploy it. I see the image in the registry, and there are options via the portal to deploy it to an AppService or ContainerInstance, but not to a ContainerApp.
I also have looked through the az CLI, specifically az containerapp, but see no way to stop a running instance. I can set the scale to 0-1, but it still runs.
Am I missing something? Stopping an instance seems like a pretty normal thing to do...
EDIT - Setting all revisions to inactive doesn't seem to be allowed. See images below.
You can deactivate a revision to shut down the containers. If you deactivate all active revisions, you will effectively stop your containerapp.
https://learn.microsoft.com/en-us/azure/container-apps/application-lifecycle-management
Once a revision is no longer needed, you can deactivate a revision with the option to reactivate later. During deactivation, containers in the revision are shut down.
When you need it again, you can use activate to get new replicas.
az containerapp revision deactivate --resource-group
--revision
[--name]
az containerapp revision activate --resource-group
--revision
[--name]
If you visit the containerapp url after deactivating all revisions, you will receive an error:
Error 403 - This Container App is stopped.
Related
I added a variable to the configuration settings area of my application and I need to delete it now because I do not need it or want that setting anymore. It's called WEBSITE_TIME_ZONE. I would like to get rid of the setting but I can't.
I have clicked on the delete button but it does not work. As soon as I refresh the page or log back in, the setting/variable (WEBSITE_TIME_ZONE) is there once again.
I have tried multiple browsers and clearing cache but none of that works.
I have clicked on Advanced Edit and tried to delete it from there as well but that does not work either. It just comes back after refreshing the page, (after saving the changes).
I have tried to edited the name and the value to bogus data which I then try and delete but that does not work either. I can't even actually edit the name of the setting, WEBSITE_TIME_ZONE. After an edit I save it and as soon as I come back to the page, the variable name WEBSITE_TIME_ZONE is there again.
I have stopped the app and tried to delete the entry and then start the app again but still does not work.
I tried running this command in command prompt on the SCM back end and that does not work either. It says 'az' is not recognized as an internal or external command, operable program or batch file.
az webapp config appsettings delete --name MyWebApp --resource-group MyResourceGroup --setting-names {setting-names}
I read about typing that in the Azure CLI by using the Azure Cloud Shell, but that seems to not be included in the subscription($200 USD / month) I am already paying for see image below. I thought this would work with PowerShell or the CMD on the KUDU console SCM area but I guess not. Looks like it has to be with Azure Cloud Shell which you have have to pay for on top of the normal costs...
Is there any way to delete this app setting without having to pay for yet another service? I have searched everywhere on the internet for this and every post that I see ends in the same, "I can't delete it".
Any suggestions?
Thank you!
I am able to delete the AppSetting WEBSITE_TIME_ZONE from Application Settings without any issues.
After refreshing, I can see the AppSetting is deleted.
I thought this would work with PowerShell or the CMD on the KUDU console SCM area but I guess not.
This command has to be run from Cloud Shell.
Open the Cloud Shell.
Tried to delete with the below command in Azure cloushell - Bash.
az webapp config appsettings delete --name YourWebAppName --resource-group YourRGName --setting-names {WEBSITE_TIME_ZONE}
It says 'az' is not recognized as an internal or external command, operable program or batch file.
As you are running the cloud shell for the first, you will get this error.
We need to set the Subscription and create storage account to run commands in Cloud shell.
Follow the steps mentioned in the MSDOC - Quickstart for Bash in Azure Cloud Shell
az account list
az account set --subscription 'YourSubscriptionName'
I've created an web app running the grafana docker image as this
az group create --name grp-test-container-1
--location "West Europe"
az appservice plan create --name asp-test-container-1
--resource-group grp-test-container-1
--sku B1
--is-linux
az webapp create --resource-group grp-test-container-1
--plan asp-test-container-1
--name app-test-container-1
--deployment-container-image-name grafana/grafana:latest
Then I updated the appsettings in order to pass env variables to the docker run command
az webapp config appsettings set --name app-test-container-1
--settings GF_INSTALL_PLUGINS='grafana-azure-monitor-datasource'
--resource-group grp-test-container-1
Then I need to restart the container in order to get the added env variable in the docker run command.
I tried to restart the web app, stop/start it, change the docker image name and save under the Container Settings.. nothing works
Any suggestions?
Solution/Bug
As Charles Xu said in his answer, to reload the container you need to change the docker image and save in order to make the web app fetch the image again and apply the added env variables.
In my case, I did that change and then looked at the log output but the log never got updated. I waited 5-10 minutes and still no logs were added..
But when I visit the site and browsed to the extension, which were installed by the env varibles, I could se that it all had gone through.
So, to summarize: The log in the Container Settings are not to be trusted, when doing a change those changes might not show up in the log.
I just got off the phone with a support engineer from the Azure web apps/app services team, after having pulled my hair out for several days. Literally.
So in case anyone else having trouble with their app service not responding to restarts, configuration changes, docker image changes, etc, you can try this:
In the Azure Portal navigate to your app service and then "Configuration"->"General settings" and set the "Always on" setting to "On". This setting is by default set to "Off" and will make the app service enter an "idle state" after some time of not receiving any requests.
The only way to trigger the app service out of this idle state is to perform a request towards it. Restarts, config changes, docker image changes, etc., will have no effect until that first request is done. Setting the "Always on" setting to "On" will prevent the app service from entering this idle state, and so it will always be responsive.
In terms of cost this setting change shall have no impact. That is unless you are trying to force as many applications into a single app service plan as possible, where many of them are seldomly in use and hence in an idle state will not use any resources of your app service plan total.
What you need to do is change the image from grafana/grafana:latest into grafana/grafana, just delete the version latest and click the save button below. Then it will work.
I'm using Azure DevOps pipelines to update our deployment in K8s cluster in Azure. It used to be working fine until yesterday, as for some reason the Pods in the cluster remain in their previous state. I can see that the image was successfully updated in ACR (container registry) and has a label 'latest'. However, the release pipeline doesn't seem to be doing anything useful. I use 'set' command in the task to update the Pod (it is well described in the Kubernetes docs and cheatsheet here)
This is the command sample extracted from the log:
kubectl set image deployments/identityserver identityserver='myacr'/identityserver:latest -n identityserver-dev
As it indicates, I'm getting the latest image from ACR and trying to roll an update. It executes well (both in cmd and Azure DevOps). no errors, although, the Pod remains unaffected. Have I missed something in the docs? Should I raise the ticket with Microsoft?
why do you have ' in image name? also, latest wont work if you already have latest on the image, you need to be specific https://github.com/kubernetes/kubernetes/issues/33664.
This is not an Azure issue
Please check here answers to similar question on SO, on why it is not a good option to use :latest tag in your Deployment spec, along with workarounds provided.
Quite me to this stuff, but I seem to miss something. I push an image to a private Azure registry and spawned a container instance right through the portal. Works like a charm. Now I changed something, pushed again and... What do I do? Kill and delete the instance and recreate? Everytime?
Br,
Daniel
Another good way to do this these days is to restart the container. You can run the Azure CLI command or do it from the front end.
az container restart -g="XXX" -n="XXX"
An added benefit is that your public IP stays the same.
https://learn.microsoft.com/en-us/cli/azure/container?view=azure-cli-latest#az-container-restart
You don't need to delete every time! Just make sure your docker tag is always the same then after pushing you can just restart your app service.
tag example
docker tag myimage image.azure.ac/myimage:latest
latest in this case it's my tag
Generally - yes. But you can create a webhook that will invoke something when a new image is pushed to the repo. That can act as a way to automate redeployment.
possible solution is to use Azure Managed DNS name for container:
az container create -n helloworld --image microsoft/aci-helloworld -g myResourceGroup --dns-name-label mycontainer
this way your dns name will always stay the same
Just restart the container using the portal like the following:
Or use the following Azure CLI command if the container is on a running state.
az container restart --name <container_instance_name> --resource-group <RG_name>
To confirm the successful pull/update of the image, you should see a pull event before the start event near the time you restarted, like the following:
I have tried three installs through the portal and finally one completely through Azure CLI (with Ubuntu on Windows). Each time the deployment completes but remotely run commands because they fail with "resource temporarily unavailable". I can SSH into the master server. When I do I find the kubectl commands all come up empty (nodes, pods, namespace, version). Service --status-all does not list a single Kubernete service (I would expect to see the API service at least).
When creating through the portal I manually created the SPN and verified I could login to Azure with it. During the CLI setup I let the install create the SPN.
I have tried restarting the master but nothing changes.
What am I missing? It is probably something easy but I am spinning my tires.