CodePackage激活期间出错.Container无法启动图像

时间:2018-05-04 19:57:43

标签: azure windows-container azure-service-fabric

我已经从4.7.2-windowsservercore-ltsc2016为ASP.net MVC应用程序创建了一个图像。当我使用Docker在本地运行容器时,一切正常。我在Azure中设置了一个5节点Fabric集群,当我尝试最初部署时,我得到:

Error event: SourceId='System.FM', Property='State'.
Partition is below target replica or instance count.
fabric:/xx/yy -1 1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  (Showing 0 out of 0 replicas. Total available replicas: 0)

For more information see: http://aka.ms/sfhealth

当我看到各个节点时,我看到了:

Error event: SourceId='System.Hosting', Property='Download:1.0:1.0'.
There was an error during download

一段时间后,节点中的Health事件会发生变化并显示:

The ServicePackage was activated successfully.

然后

System.Hosting | CodePackageActivation:Code:EntryPoint

There was an error during CodePackage activation.Container failed to start for image:myrepo.azurecr.io/repo:1.0.0. failed to create endpoint sf-0-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx on network nat: HNS failed with error : The object already exists.

然后

There was an error during CodePackage activation.The service host terminated with exit code:7148

然后

The ServiceType was unregistered on the node since the Runtime or ApplicationHost closed.

我的服务清单有一个存储在Azure CR中的完整图像名称:

<ImageName>myrepo.azurecr.io/repo:1.0.0</ImageName>

同样在我的应用程序清单中,我有存储库凭据:

<RepositoryCredentials AccountName="myrepo" Password="xxxxxxxxxxxxxxxxxxxxxxxx" PasswordEncrypted="false"/>

我很乐意提供更多详细信息/日志,请告诉我从哪里获取它们。

修改

服务清单:

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="mymvcPkg"
                 Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric"
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ServiceTypes>
    <StatelessServiceType ServiceTypeName="mymvcType" UseImplicitHost="true" />
  </ServiceTypes>
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ContainerHost>
        <ImageName>myrepo.azurecr.io/repo:1.0.0</ImageName>
      </ContainerHost>
    </EntryPoint>    
  </CodePackage>
  <ConfigPackage Name="Config" Version="1.0.0" />
  <Resources>
    <Endpoints>
      <Endpoint Name="mymvcTypeEndpoint" UriScheme="http" Port="80" Protocol="http" />
    </Endpoints>
  </Resources>
</ServiceManifest>

申请清单:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest ApplicationTypeName="MvcType"
                     ApplicationTypeVersion="1.0.0"
                     xmlns="http://schemas.microsoft.com/2011/01/fabric"
                     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Parameters>
    <Parameter Name="mymvc_InstanceCount" DefaultValue="-1" />
  </Parameters>  
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="mymvcPkg" ServiceManifestVersion="1.0.0" />
    <ConfigOverrides />
    <Policies>
      <ContainerHostPolicies CodePackageRef="Code">
        <RepositoryCredentials AccountName="myrepo" Password="xxxxxxxxxxxxx" PasswordEncrypted="false"/>
        <PortBinding ContainerPort="80" EndpointRef="mymvcTypeEndpoint"/>
      </ContainerHostPolicies>
    </Policies>
  </ServiceManifestImport>
  <DefaultServices>    
    <Service Name="mymvc" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="mymvcType" InstanceCount="[mymvc_InstanceCount]">
        <SingletonPartition />
      </StatelessService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

1 个答案:

答案 0 :(得分:0)

我遇到的问题是我用于群集中的VM(节点)的实例类型。 Azure支持在其某些日志中发现错误:

System.ComponentModel.Win32Exception (0x80004005): Not enough storage is available to process this command

切换到更强大的实例解决了这个问题。微软表示:

  

支持的最小使用VM SKU是标准D1或标准D1_V2或   相当于至少14 GB的本地SSD

尽管虚拟机我一直在尝试配置20GB,但它们无法正常工作。目前我正在对SKU A2进行测试,到目前为止似乎工作正常。微软还表示:

  

•不支持标准A0等部分核心VM SKU   生产工作量

     

•生产工作负载不支持标准A1 SKU   表现原因。

考虑到上述情况,D1_V2(3.5GB RAM,50GB SSD)可能是最便宜的选择。