C
C#10mo ago
acookook

Running gRPC service inside a docker container on a kubernetes cluster

May just be the same question, on which I get a different error, seen on this image. So, I have a microservice where I can also retrieve data via gRPC, but the thing only works locally with developer certificates. When I call the gRPC endpoint running from a Docker container, I get the following exception: [link to exception]. At this point, I honestly don't understand exactly what I need to do, or rather, I know I need to: Generate a certbot certificate for the specific microservice. Include this certificate in the Docker image so that I can somehow get around Github CI (okay, I could just push the dev Docker image, but that's not correct). Ensure that it runs on the Kubernetes cluster. I'm already having trouble just generating the certificate on the Docker container. All the guides require me to run docker-compose and do something else, which in my case (as far as I understand) is not applicable. It's clear to me that I don't understand certain things, but I'm interested in where (aside from official documentation) I can learn more. I would just like to run my microservices inside of the docker containers on a kubernetes cluster.
No description
1 Reply
acookook
acookookOP10mo ago
public List<Ad> GetUsersAdsByRPC(int userId)
{
var channel = GrpcChannel.ForAddress("http://kubernetes-ingress:80/ads/api/grpc/{userID}}" + userId);
var client = new AdProto.AdProtoClient(channel);

var reply = client.GetAdsByUserId(new AdByIdUserIdRequest { UserId = userId });
if (!reply.Ads.Any())
return Enumerable.Empty<Ad>().ToList();
var ads = new List<Ad>();
foreach (var adItem in reply.Ads)
{
var ad = new Ad()
{
ID = adItem.Id,
Category = adItem.Category,
Thing = adItem.Thing,
Price = adItem.Price,
UserId = userId,
PostTime = DateTime.ParseExact(adItem.PublishDate, "MM/dd/yyyy HH:mm:ss", new CultureInfo("si-SI"))
};
ads.Add(ad);
}
return ads;
}
}
public List<Ad> GetUsersAdsByRPC(int userId)
{
var channel = GrpcChannel.ForAddress("http://kubernetes-ingress:80/ads/api/grpc/{userID}}" + userId);
var client = new AdProto.AdProtoClient(channel);

var reply = client.GetAdsByUserId(new AdByIdUserIdRequest { UserId = userId });
if (!reply.Ads.Any())
return Enumerable.Empty<Ad>().ToList();
var ads = new List<Ad>();
foreach (var adItem in reply.Ads)
{
var ad = new Ad()
{
ID = adItem.Id,
Category = adItem.Category,
Thing = adItem.Thing,
Price = adItem.Price,
UserId = userId,
PostTime = DateTime.ParseExact(adItem.PublishDate, "MM/dd/yyyy HH:mm:ss", new CultureInfo("si-SI"))
};
ads.Add(ad);
}
return ads;
}
}
Want results from more Discord servers?
Add your server