Asp.net core “我的服务为什么?”;“无法启动红隼”;仅在EKS中?
我有一个非常奇怪和恼人的库伯内特斯问题。我开发了登录服务(like),在我的Windows笔记本电脑上运行时,它可以正常工作。此外,在我的本地Kubernetes单节点集群上运行它时,它也可以正常工作,使用Docker Desktop激活。在我的情况下,Docker desktop使用集成了WSL(2)的Linux容器。它希望在我的EKS集群上的行为是相同的,而这根本不会发生。让我首先描述一下相关文件 这是我的部署文件:Asp.net core “我的服务为什么?”;“无法启动红隼”;仅在EKS中?,asp.net-core,kubernetes,amazon-eks,.net-5,kestrel,Asp.net Core,Kubernetes,Amazon Eks,.net 5,Kestrel,我有一个非常奇怪和恼人的库伯内特斯问题。我开发了登录服务(like),在我的Windows笔记本电脑上运行时,它可以正常工作。此外,在我的本地Kubernetes单节点集群上运行它时,它也可以正常工作,使用Docker Desktop激活。在我的情况下,Docker desktop使用集成了WSL(2)的Linux容器。它希望在我的EKS集群上的行为是相同的,而这根本不会发生。让我首先描述一下相关文件 这是我的部署文件: apiVersion: apps/v1 kind: Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: xxxxxxxx
spec:
selector:
matchLabels:
app: xxxxxxxx
replicas: 3
template:
metadata:
labels:
app: xxxxxxxx
spec:
containers:
- name: xxxxxxxx
image: yyyyyy.dkr.ecr.qqqqq.amazonaws.com/xxxxxxxx:2676
livenessProbe:
httpGet:
path: /health/live
port: 80
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /health/ready
port: 80
initialDelaySeconds: 30
timeoutSeconds: 5
ports:
- containerPort: 80
env:
- name: "ASPNETCORE_ENVIRONMENT"
value: "KubernetesDevelopment"
volumeMounts:
- name: secrets
mountPath: /secret
readOnly: true
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
volumes:
- name: secrets
secret:
secretName: secret-appsettings
imagePullSecrets:
- name: awspull
这是我的Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:5.0.4-alpine3.13 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["QQQQQ.API/QQQQQ.API.csproj", "QQQQQ.API/"]
RUN dotnet restore "QQQQQ.API/QQQQQ.API.csproj"
COPY . .
WORKDIR "/src/QQQQQ.API"
RUN dotnet build "QQQQQ.API.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "QQQQQ.API.csproj" -c Release -o /app/publish
FROM base AS final
RUN addgroup -S lirantal && adduser -S lirantal -G lirantal
WORKDIR /app
COPY --from=publish /app/publish .
RUN chown -R lirantal:lirantal /app
USER lirantal
CMD cp /secret/*.* /app && dotnet QQQQQ.API.dll
这是已记录的内容(在我自己的本地Kubernetes群集上):
警告:
Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
在目录中存储密钥
可能无法持久化的“/home/lirantal/.aspnet/DataProtection key”
在容器外面。受保护的数据将在以下情况下不可用:
集装箱被毁
警告:
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
没有配置XML加密程序。钥匙
{e13ce6cb-c64d-4aaf-ad4f-1a345c73f5bc}可以持久化到中的存储
未加密的形式
信息:Microsoft.Hosting.Lifetime[0]
现在收听:http://[:]:80
信息:Microsoft.Hosting.Lifetime[0]
应用程序已启动。按Ctrl+C组合键关闭
信息:Microsoft.Hosting.Lifetime[0]
托管环境:KubernetesDevelopment
信息:Microsoft.Hosting.Lifetime[0]
内容根路径:/app
警告:Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
无法确定重定向的https端口
这是在AWS EKS中运行时记录的内容:
加载。。。[40米[1米[33米瓦恩[39米[22米[49米:
Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
在目录中存储密钥
可能无法持久化的“/home/lirantal/.aspnet/DataProtection key”
容器外部。受保护的数据在以下情况下不可用:
集装箱被毁。[40米[1米[33米瓦恩[39米[22米[49米:
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]号
已配置XML加密程序。密钥{04076fdc-f191-4253-9dc4-dbc77981d9b3}
可以以未加密的形式保存到存储器。
[41m[1m[37mcrit[39m[22m[49m:
>Microsoft.AspNetCore.Server.Kestrel[0]无法启动Kestrel。
System.Net.Sockets.SocketException(13):在拒绝权限
System.Net.Sockets.Socket.UpdateStatusAfterSocketerRor和RowException(SocketError
在System.Net.Sockets.Socket.DoBind(端点)处出现错误,字符串callerName)
端点快照,SocketAddress(SocketAddress)位于
位于的System.Net.Sockets.Socket.Bind(端点localEP)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.g|u BindSocket | 13|0(c|u DisplayClass13|0&
)在
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
在
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(端点
端点,CancellationToken CancellationToken)位于
Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(端点
端点,连接Legate连接Legate,端点配置
端点配置)位于
Microsoft.AspNetCore.Server.Kestrel.Core.kestrelserver impl.c_udisplayClass29_01.d.MoveNext()---上一位置的堆栈结束跟踪---位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions端点,AddressBindContext上下文)位于Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext上下文),位于Microsoft.AspNetCore.Server.Kestrel.Core.AnyIPListenOptions.BindAsync(AddressBindContext上下文),位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressStrategy.BindAsync(AddressBindContext上下文)在Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable
1
listenOptions,AddressBindContext)位于
Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken
取消令牌)在
Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer Impl.StartAsync[TContext](IHTTP应用程序1应用程序,CancellationToken CancellationToken)未处理的异常。System.Net.Sockets.SocketException(13):在System.Net.Sockets.Socket.UpdateStatusAfterSocketerRorror和RowException(SocketerRow错误,字符串callerName)上的权限被拒绝位于Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.g_ubindsocket 130(c_udisplayClass130&)的System.Net.Sockets.Socket.Socket.DoBind(EndPoint EndPoint endPointSnapshot,SocketAddress SocketAddress SocketAddress)和System.Net.Sockets.Sockets.Bind(EndPoint localEP)位于Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()的Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(端点端点,取消令牌取消令牌)的Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint-EndPoint,connectionelegate-connectionelegate,EndpointConfig-EndpointConfig)位于Microsoft.AspNetCore.Server.Kestrel.Core.kestrelserver impl.c_udisplayClass29_0
1.d.MoveNext()
---来自上一个位置的堆栈结束跟踪---位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions
端点,AddressBindContext)位于
Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext
(上下文)在
Microsoft.AspNetCore.Server.Kestrel.Core.AnyIPListenOptions.BindAsync(AddressBindContext
(上下文)在
Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext
(上下文)在
Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable1 listenOptions,AddressBindContext上下文)位于Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken CancellationToken)位于Microsoft.AspNetCor
kubectl apply -f deployment.yml