I feel it is best to present my basic steps. Hopefully, that is more informative.
1. Create
ASP.NET Core GRPC Service. Leave the default greet.proto file in place.
https://docs.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-5.0&tabs=visual-studio
2.
Install-Package Grpc.AspNetCore.Server.Reflection
3. Add
services.AddGrpcReflection();
and
endpoints.MapGrpcReflectionService();
to
Startup.cs
4. Run app in Visual Studio
5. Test with
grpcurl -d '{ \"name\": \"Say Hello\" }' localhost:5001 greet.Greeter/SayHello
Successful response
6. Build and deploy docker image via AzDO Pipelines to private Azure ACR
7. Env var on container
spec
in pulumi app
a.
{ name: "ASPNETCORE_ENVIRONMENT", value: "Development" },
b.
{ name: "DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP2UNENCRYPTEDSUPPORT", value: "true" },
c.
{ name: "ASPNETCORE_URLS", value: "http://+:5000" },
8. ports on
Service
resource in pulumi app
d.
ports: [{ port: 5000, targetPort: 5000, protocol: consts.tcpTransport }]
9.
Ingress
resource created in pulumi app with
e.
<http://nginx.ingress.kubernetes.io/backend-protocol|nginx.ingress.kubernetes.io/backend-protocol>: GRPCS
annotation
10.
grpcurl -plaintext -d '{ \"name\": \"Say Hello\" }' <pod-ip>:5000 greet.Greeter/SayHello
succeeds (going directly to pod via Azure CNI networking)
11. Port-foward pod to local host via k9s
12.
grpcurl -plaintext -d '{ \"name\": \"Say Hello\" }' localhost:8090 greet.Greeter/SayHello
succeeds
13.
grpcurl -d '{ \"name\": \"Say Hello\" }' <public-dns-entry>:443 greet.Greeter/SayHello
fails
f.
Failed to dial target host "<public-dns-entry>:443": context deadline exceeded
14.
nginx-ingress-controller pod logs following 4 attempts
g. *<inbound IP Address> - - [11/May/2021
1303:04 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"*
15.
grpcurl -d '{ \"name\": \"Say Hello\" }' <public-dns-entry>:80 greet.Greeter/SayHello
fails
h. Failed to dial target host "<public-dns-entry>:80": tls: first record does not look like a TLS handshake
i. no logs to ingress-controller pod
16.
grpcurl -d '{ \"name\": \"Say Hello\" }' <public-dns-entry>:5000 greet.Greeter/SayHello
fails
j.
Failed to dial target host "<public-dns-entry>:5000": context deadline exceeded
k. no logs to ingress-controller pod