portainer / portainer

Making Docker and Kubernetes management easy.
https://www.portainer.io
zlib License
31.08k stars 2.48k forks source link

Azure Container Instance (ACI) endpoint errors #5335

Open JamborJan opened 3 years ago

JamborJan commented 3 years ago

Bug description I followed these instructions to set up Azure Container Instance ACI as an endpoint: https://support.portainer.io/kb/article/37-how-to-using-portainer-to-manage-azure-container-instances/

Behavior with Portainer V2.7.0:

Existing ACI are not shown. I see an error "unable to retrieve resources"

existing-aci-error

I try to create a new ACI and I get an error "Unable to create container"

create-aci-error

But actually the container is created. When I redo the same operation with the same container name, I get "A container instance with the same name already exists within the selected resource group".

create-aci-already-exists

And when I take a look in the Azure portal I also see this container instance and it is working as expected.

I also saw some errors in the browsers console. You can see them in all screenshots above too.

Behavior with Portainer V2.4.1: only slightly different, I get a success message when creating the container but when the UI jumps back to the overview I get again the error listing existing containers and see nothing.

Expected behavior

Portainer Logs Provide the logs of your Portainer container or Service. You can see how here

2021/07/19 12:46:51 http: proxy error: content type is not supported for unmarshaling: application/json; charset=utf-8

Steps to reproduce the issue:

  1. Add ACI as endpoint as described here
  2. Open the new endpoint, you'll see the first error "unable to retrieve resources"
  3. Create a new container, it will take only few seconds and then the error "Unable to create container" will occur
  4. But the container actually was created when you check in the Azure portal

Technical details:

Additional context Add any other context about the problem here.

JamborJan commented 3 years ago

According to a discussion on Slack we had, this is a known bug (or incompatibility) of Portainer with Azure Container Instances that have more than one container in it.

huib-portainer commented 3 years ago

We have a preview version available that fixes this: The image for CE portainerci/portainer:pr5356 The image for BE portainerci/portainer-ee:pr563 Note that these are development builds and should not be used in a production environment.

JamborJan commented 3 years ago

I installed the image for BE portainerci/portainer-ee:pr563 on my test environment and added a ACI with an existing 2 container group which was created by terraform before. As soon as I click on "Container Instances" I get this error:

Failure
Unable to retrieve resources
Bildschirmfoto 2021-07-28 um 11 49 08

Nothing to see in Portainer logs.

huib-portainer commented 3 years ago

I'll have a closer look later, but in the mean time can you double check you've cleared your browser cache?

JamborJan commented 3 years ago

I did clear all browser cache now and tried it again without any other result. Error is still the same.

huib-portainer commented 3 years ago

Ah, thanks for checking that. We're currently investigating it. We suspect it still has something to do with resource groups.

Also note that the preview build will be a bug fix in order to prevent the ACI section from falling over. It isn't intended to bring full support for having multiple containers in the same container group.

huib-portainer commented 3 years ago

I had another look at this, but wasn't able to reproduce it on the portainerci/portainer-ee:pr563 build.

I basically followed the steps from https://docs.microsoft.com/en-us/azure/container-instances/container-instances-multi-container-group:

az group create --nametestgroup --location australiaeast
az deployment group create --resource-grouptestgroup --template-file azuredeploy.json

Which runs fine on ACI: image

And when I navigate to the Container instances in Portainer, the list of containers is being shown. image

JamborJan commented 3 years ago

Hi @huib-portainer , sorry for the long delay of my answer. I have no idea why it’s not working for me. Is there anything I can do to debug this?

huib-portainer commented 3 years ago

That second bug is actually caused by the code expecting that for each IP address for the container group, there will be an exposed port on the container instance. We currently don't have any fix for that yet.

huib-portainer commented 3 years ago

@JamborJan can you give this a try? Use the image portainerci/portainer:develop or portainerci/portainer-ee:develop. Note that this is a development build and should not be used in a production environment.

JamborJan commented 3 years ago

Thanks @huib-portainer .

I've used portainerci/portainer-ee:develop which showed up as version 2.10.0 and connected to my existing Azure Container Instance. I can now list the existing container groups, but I cannot create new ones. The following error is shown in the portainer logs. The picture below is quite pointless as the error message "Failure Unable to create container" doesn't bring any additional value I guess. But you see how I filled out the fields.

level=info msg="2021/11/03 06:10:17 http: proxy error: Missing container group ID"
Bildschirmfoto 2021-11-03 um 07 11 59

Add-on question: is it right that I cannot edit existing containers and container groups and also not see logs or ssh into containers? That's something I would expect in terms of a consistent user experience across back-end technologies (docker, docker swarm, Kubernetes, and ACI). Needless to say that me having the expectation doesn't mean you have to that :-)

JamborJan commented 3 years ago

I forgot to mention: when having a multi-container ACI, you only see one container. Also the exposed ports are not accurate. If you need a test scenario please deploy something like this: https://github.com/xware-gmbh/portainer-control-node-example

JamborJan commented 3 years ago

@DimaSalakhov why has this issue been closed and how can I re-open it? This has not been solved at all. Thanks for explaining how to proceed.

huib-portainer commented 3 years ago

I think it got closed because a PR got merged.