# .NET core app unsuccessful transfer to APM server on Kubernetes

**URL:** <https://discuss.elastic.co/t/net-core-app-unsuccessful-transfer-to-apm-server-on-kubernetes/264242>\
**Category:** APM\
**Tags:** docker, dotnet\
**Created:** [February 14, 2021, 9:59am UTC](https://discuss.elastic.co/t/net-core-app-unsuccessful-transfer-to-apm-server-on-kubernetes/264242 "2021-02-14T09:59:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![greenfield](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@greenfield](https://discuss.elastic.co/u/greenfield)\
**Post date:** [February 14, 2021, 9:59am UTC](https://discuss.elastic.co/t/net-core-app-unsuccessful-transfer-to-apm-server-on-kubernetes/264242/1 "2021-02-14T09:59:27Z")

</div>

**Kibana version** : 7.11

**Elasticsearch version** : 7.11

**APM Server version** : 7.11

**APM Agent language and version** : .NET\_Core/3.1.12

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: ECK operator via [https://download.elastic.co/downloads/eck/1.4.0/all-in-one.yaml](https://download.elastic.co/downloads/eck/1.4.0/all-in-one.yaml)

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**: Unable to send APM Agent data to APM server hosted on Kubernetes. The appsettings.json contains the public IP of the APM server. Should I be able to curl the public IP of the APM server? My config is using out-of-the-box self-signed certs.

**Steps to reproduce** :

1. Install APM server via ECK
2. Create .NET Core app & add nuget package
3. Update appsettings.json
4. Update startup.cs
5. Create container and deploy in seperate namespace

**appsettings.json**

{  
"Logging": {  
"LogLevel": {  
"Default": "Information",  
"Microsoft": "Warning",  
"Microsoft.Hosting.Lifetime": "Information",  
"Elastic.Apm": "Debug"  
}  
},  
"AllowedHosts": "\*",  
"ElasticApm":  
{  
"ServerUrls": "[http://20.73.125.50:8200](http://20.73.125.50:8200)",  
"SecretToken": "jN5H8wSRla50297t22vtfto0",  
"ServiceName": "myapp1"  
}  
}

**Startup.cs**  
using Elastic.Apm.NetCoreAll;  
...  
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)  
{  
app.UseAllElasticApm(Configuration);  
...

**Kubernetes svc overview**  
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE  
default kubernetes ClusterIP 10.0.0.1 443/TCP 77m  
elastic-system apmserver-apm-http LoadBalancer 10.0.106.60 20.73.125.50 8200:31985/TCP 68m  
elastic-system elastic-webhook-server ClusterIP 10.0.181.159 443/TCP 69m  
elastic-system elasticsearch-es-default ClusterIP None 9200/TCP 68m  
elastic-system elasticsearch-es-http LoadBalancer 10.0.38.17 20.73.124.228 9200:32553/TCP 68m  
elastic-system elasticsearch-es-transport ClusterIP None 9300/TCP 68m  
elastic-system kibana-kb-http LoadBalancer 10.0.92.26 20.73.125.44 5601:31085/TCP 68m  
kube-system kube-dns ClusterIP 10.0.0.10 53/UDP,53/TCP 77m  
kube-system metrics-server ClusterIP 10.0.112.50 443/TCP 77m  
myapp1 myapp1 ClusterIP 10.0.13.193 80/TCP 65m

**Verify access to APM public IP**  
curl -i [https://20.73.125.50:8200](https://20.73.125.50:8200)  
curl: (60) SSL certificate problem: self signed certificate in certificate chain  
More details here: [https://curl.haxx.se/docs/sslcerts.html](https://curl.haxx.se/docs/sslcerts.html)

curl failed to verify the legitimacy of the server and therefore could not  
establish a secure connection to it. To learn more about this situation and  
how to fix it, please visit the web page mentioned above.

**.NET Core container logs**  
fail: Elastic.Apm[0]  
{CentralConfigFetcher} Exception was thrown while fetching configuration from APM Server and parsing it. ETag: `<null>'. URL: `[http://20.73.125.50:8200/config/v1/agents?service.name=myapp1&service.environment=Production](http://20.73.125.50:8200/config/v1/agents?service.name=myapp1&service.environment=Production)'. Apm Server base URL: `http://20.73.125.50:8200/'. WaitInterval: 5m. dbgIterationsCount: 1.  
+-\> Request:  
Method: GET, RequestUri: '[http://20.73.125.50:8200/config/v1/agents?service.name=myapp1&service.environment=Production](http://20.73.125.50:8200/config/v1/agents?service.name=myapp1&service.environment=Production)', Version: 1.1, Content: , Headers:  
{  
User-Agent: elasticapm-dotnet/1.7.1  
User-Agent: System.Net.Http/4.700.21.6905  
User-Agent: .NET\_Core/3.1.12  
Authorization: Bearer jN5H8wSRla50297t22vtfto0  
}  
+-\> Response:  
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.0, Content: System.Net.Http.HttpConnectionResponseContent, Headers:  
{  
}  
+-\> Response body [length: 48]:  
Client sent an HTTP request to an HTTPS server.

warn: Elastic.Apm[0]  
{PayloadSenderV2} Failed reading APM server info, response from server: BadRequest  
dbug: Elastic.Apm[0]  
{PayloadSenderV2} Enqueued MetricSet. newEventQueueCount: 1. MaxQueueEventCount: 1000. MetricSet: Elastic.Apm.Metrics.MetricSet.  
dbug: Elastic.Apm[0]  
{MetricsCollector} Metrics collected: MetricSample{system.process.cpu.total.norm.pct: 0.017932134045491432}, MetricSample{system.cpu.total.norm.pct: 0.15930999492643327}, MetricSample{system.process.memory.size: 9618743296}, MetricSample{system.process.memory.rss.bytes: 91856896}, MetricSample{system.memory.total: 8349163520}, MetricSample{system.memory.actual.free: 5830754304}, MetricSample{system.process.cgroup.memory.stats.inactive\_file.bytes: 0}, MetricSample{system.process.cgroup.memory.mem.usage.bytes: 35168256}, MetricSample{system.process.cgroup.memory.mem.limit.bytes: 2147483648}  
warn: Elastic.Apm[0]  
{PayloadSenderV2} Failed sending events. Following events were not transferred successfully to the server ([http://20.73.125.50:8200/](http://20.73.125.50:8200/)):  
Elastic.Apm.Metrics.MetricSet

---

<div class="post-metadata">

**Author:** ![greenfield](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@greenfield](https://discuss.elastic.co/u/greenfield)\
**Post date:** [February 15, 2021, 8:15pm UTC](https://discuss.elastic.co/t/net-core-app-unsuccessful-transfer-to-apm-server-on-kubernetes/264242/2 "2021-02-15T20:15:54Z")

</div>

I added the following to the eck apm server config:

```auto
http:

    tls:

      selfSignedCertificate:

        disabled: true

```

This solved the issue. Metrics are now forwarded to the APM server. BUT I don't see anything in the Kibana APM portal. Services and Traces remain empty.

Below the log output of the .NET Core application:

dbug: Elastic.Apm[0]  
{CentralConfigFetcher} Combined absolute URL for APM Server get central configuration endpoint: `http://20.76.20.108:8200/config/v1/agents?service.name=myapp1&service.environment=Production'. Service: Service{Name: myapp1, Version: 1.0.0, Environment: Production, Runtime: Runtime{Name: .NET Core, Version: 3.1.12}, Framework: null, Agent: AgentC{Name: dotnet, Version: 1.7.1}, Language: null, Node: Node{ConfiguredName: null}}.  
dbug: Elastic.Apm[0]

dbug: Elastic.Apm[0]  
{MetricsCollector} Metrics collected: MetricSample{system.process.cpu.total.norm.pct: 0.0006667152524294954}, MetricSample{system.cpu.total.norm.pct: 0.1652765957446809}, MetricSample{system.process.memory.size: 9635901440}, MetricSample{system.process.memory.rss.bytes: 111722496}, MetricSample{system.memory.total: 8349163520}, MetricSample{system.memory.actual.free: 5869801472}, MetricSample{system.process.cgroup.memory.stats.inactive\_file.bytes: 0}, MetricSample{system.process.cgroup.memory.mem.usage.bytes: 54075392}, MetricSample{system.process.cgroup.memory.mem.limit.bytes: 2147483648}  
dbug: Elastic.Apm[0]  
{PayloadSenderV2} Sent items to server:  
Elastic.Apm.Metrics.MetricSet  
dbug: Elastic.Apm[0]  
{PayloadSenderV2} Enqueued MetricSet. newEventQueueCount: 1. MaxQueueEventCount: 1000. MetricSet: Elastic.Apm.Metrics.MetricSet.  
dbug: Elastic.Apm[0]  
{MetricsCollector} Metrics collected: MetricSample{system.process.cpu.total.norm.pct: 0.0009999753472744385}, MetricSample{system.cpu.total.norm.pct: 0.17254835425856807}, MetricSample{system.process.memory.size: 9635901440}, MetricSample{system.process.memory.rss.bytes: 111722496}, MetricSample{system.memory.total: 8349163520}, MetricSample{system.memory.actual.free: 5870059520}, MetricSample{system.process.cgroup.memory.stats.inactive\_file.bytes: 0}, MetricSample{system.process.cgroup.memory.mem.usage.bytes: 54255616}, MetricSample{system.process.cgroup.memory.mem.limit.bytes: 2147483648}  
dbug: Elastic.Apm[0]  
{PayloadSenderV2} Sent items to server:  
Elastic.Apm.Metrics.MetricSet

---

<div class="post-metadata">

**Author:** ![greenfield](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@greenfield](https://discuss.elastic.co/u/greenfield)\
**Post date:** [February 17, 2021, 6:15pm UTC](https://discuss.elastic.co/t/net-core-app-unsuccessful-transfer-to-apm-server-on-kubernetes/264242/3 "2021-02-17T18:15:13Z")

</div>

I paste below 2 queries via DEV TOOLS:  
**GET apm-\*/\_search**  
{  
"took" : 2,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 6,  
"successful" : 6,  
"skipped" : 0,  
"failed" : 0  
},  
"hits" : {  
"total" : {  
"value" : 34,  
"relation" : "eq"  
},  
"max\_score" : 1.0,  
"hits" : [  
{  
"\_index" : "apm-7.11.0-metric-000001",  
"\_type" : "\_doc",  
"\_id" : "Y30fsXcBfz0eGlIAWTwC",  
"\_score" : 1.0,  
"\_source" : {  
"container" : {  
"id" : "006d970e58a069cf123d3d10287404716e81f4c9b57b53956dd9df26d0ef03fb"  
},  
"kubernetes" : {  
"pod" : {  
"uid" : "006d970e58a069cf123d3d10287404716e81f4c9b57b53956dd9df26d0ef03fb",  
"name" : "theapp1-7c8c5db7f5-2cmkd"  
}  
},  
"agent" : {  
"name" : "dotnet",  
"version" : "1.7.1"  
},  
"processor" : {  
"name" : "metric",  
"event" : "metric"  
},  
**GET /\_template/apm-7.11.0**  
{  
"apm-7.11.0" : {  
"order" : 1,  
"index\_patterns" : [  
"apm-7.11.0\*"  
],  
"settings" : {  
"index" : {  
"codec" : "best\_compression",  
"mapping" : {  
"total\_fields" : {  
"limit" : "2000"  
}  
},  
"refresh\_interval" : "5s",  
"number\_of\_shards" : "1",  
"max\_docvalue\_fields\_search" : "200",  
"query" : {  
"default\_field" : [  
"message",  
"tags",  
"agent.ephemeral\_id",  
"agent.id",  
"agent.name",  
"agent.type",  
"agent.version",

**logs APM server container:**  
41932-10ec-49ed-9931-61ef22e2de55","event.duration":104900,"http.response.status\_code":200,"ecs.version":"1.6.0"}  
{"log.level":"info","@timestamp":"2021-02-17T18:12:35.533Z","log.logger":"request","log.origin":{"file.name":"middleware/log\_middleware.go","file.line":63},"message":"request ok","url.original":"/","http.request.method":"GET","user\_agent.original":"kube-probe/1.18","source.address":"11.0.1.4","http.request.body.bytes":0,"http.request.id":"263e62c4-afb4-4642-88f1-99254d727176","event.duration":110801,"http.response.status\_code":200,"ecs.version":"1.6.0"}  
{"log.level":"info","@timestamp":"2021-02-17T18:12:36.788Z","log.logger":"request","log.origin":{"file.name":"middleware/log\_middleware.go","file.line":63},"message":"request accepted","url.original":"/intake/v2/events","http.request.method":"POST","user\_agent.original":"elasticapm-dotnet/1.7.1 System.Net.Http/4.700.21.6905 .NET\_Core/3.1.12","source.address":"11.0.1.4","http.request.body.bytes":1509,"http.request.id":"be2c5663-fe3a-47bc-85dd-17cb71d1b910","event.duration":219901,"http.response.status\_code":202,"ecs.version":"1.6.0"}  
{"log.level":"info","@timestamp":"2021-02-17T18:12:38.856Z","log.logger":"request","log.origin":{"file.name":"middleware/log\_middleware.go","file.line":63},"message":"not modified","url.original":"/config/v1/agents?service.name=myapp1&service.environment=Production","http.request.method":"GET","user\_agent.original":"elasticapm-dotnet/1.7.1 System.Net.Http/4.700.21.6905 .NET\_Core/3.1.12","source.address":"11.0.1.4","http.request.body.bytes":0,"http.request.id":"783f76ce-a2a6-4c3c-b5d0-469ce988fc06","event.duration":88138289,"http.response.status\_code":304,"ecs.version":"1.6.0"}

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [February 17, 2021, 6:41pm UTC](https://discuss.elastic.co/t/net-core-app-unsuccessful-transfer-to-apm-server-on-kubernetes/264242/4 "2021-02-17T18:41:52Z")

</div>

Hi,

regarding the failing connection to APM Server:  
supporting self signed certificates is already work in progress for the .NET Agent: [Support self-signed certificates · Issue #1171 · elastic/apm-agent-dotnet · GitHub](https://github.com/elastic/apm-agent-dotnet/issues/1171)

regarding not seeing transactions: based on the logs there isn't really any load on the app - if it's a web app, you need some requests, if it's not a web app, you need to manually start transactions.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 10, 2021, 2:42pm UTC](https://discuss.elastic.co/t/net-core-app-unsuccessful-transfer-to-apm-server-on-kubernetes/264242/5 "2021-03-10T14:42:02Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
