fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to provide namespace wtih grpcurl

coolninja1504 opened this issue · comments

Hi All,
I am using grpcurl to get list of images from containerd as follows:

grpcurl -plaintext -proto images.proto -unix /run/containerd/containerd.sock containerd.services.images.v1.Images/List

but getting following error:
ERROR:
Code: FailedPrecondition
Message: namespace is required: failed precondition

I tried giving the namespace as follows , but then getting another error:
./grpcurl -plaintext -d '{"namespace":"k8s.io"}' -proto images.proto -unix /run/containerd/containerd.sock containerd.services.images.v1.Images/List
Error invoking method "containerd.services.images.v1.Images/List": error getting request data: message type containerd.services.images.v1.ListImagesRequest has no known field named namespace

How can I give the namespace with grpcurl ?

Thanks

This is really a question for the containerd project, about how to use their API.

FWIW, you can use grpcurl describe to look at the definition for the RPC request (or look at API docs). Those show that there is no field named namespace; only a field named filters, which is an array of strings.

I happened to do some searching and found a hint here. In their example, showing a REST mapping for the gRPC API, they are setting a header named containerd-namespace. So I'm going to guess that you need an argument like -H "containerd-namespace: k8s.io". But if that doesn't work, this is not the place for more questions. I'd recommend asking in the containerd Slack: https://slack.containerd.io/