问题描述
我正在尝试使用dotnet-trace和dotnet计数器为部署在kubernetes(GKE)集群上的应用程序启用性能诊断。为此,我在应用程序容器中添加了性能诊断工具。 diagnostics.Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS tools
RUN dotnet tool install --tool-path /tools dotnet-trace
RUN dotnet tool install --tool-path /tools dotnet-counters
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS runtime
COPY --from=tools /tools /tools
ENV PATH="/tools:${PATH}"
ENV COMPlus_EnableDiagnostics="0"
WORKDIR /tools
我在这里使用的应用程序是一个简单的hello world应用程序。 这就是我在GKE上部署这些容器的方式: deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-dotnet-diagnostics
spec:
replicas: 1
selector:
matchLabels:
app: demo-diagnostics
template:
metadata:
labels:
app: demo-diagnostics
spec:
shareProcessNamespace: true
containers:
- name: demo-app
image: gcr.io/qp-fda-mystudies-2020-07/dotnetapp:latest
ports:
- containerPort: 8080
volumeMounts:
- name: dotnet-diagnostics
mountPath: /tmp
- name: demo-diagnostics
image: gcr.io/qp-fda-mystudies-2020-07/diagnostics:latest
stdin: true
tty: true
command: ["/bin/sh","-c"]
args: ["dotnet-trace collect -p 1; dotnet-counters monitor -p 1"]
volumeMounts:
- name: dotnet-diagnostics
mountPath: /tmp
volumes:
- name: dotnet-diagnostics
emptyDir: {}
我在这里面临的问题是诊断容器不断进入crashloopbackoff。我在这里遇到的错误是:无法启动计数器会话:Microsoft.Diagnostics.NETCore.Client.ServerNotAvailableException:进程1未运行兼容的.NET运行时。 我一直在关注这些文章和主题: https://github.com/dotnet/diagnostics/issues/810和https://im5tu.io/article/2020/01/diagnostics-in-.net-core-3-using-dotnet-counters-with-docker/ 目标是在后台运行这些诊断过程,并将使用这些工具捕获的信息推送到stackdriver。 我不知道我在这里缺少什么,因为我是dotnet的新手。请帮忙。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)