How to use field_selector
See original GitHub issuehi,I want to list service in specified namespace. I call list_namespaced_service,but output error. This is my code:
field_selector = {'spec.selector': label} //label: {u'app': 'admin-test'}
service = v1.list_namespaced_service(namespace='default', pretty='true', field_selector=field_selector, watch=False)
error:
ApiException: (500)
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Date': 'Wed, 05 Apr 2017 03:57:23 GMT', 'Content-Length': '240', 'Content-Type': 'application/json'})
HTTP response body: {
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "invalid selector: '{'spec.selector': {u'app': 'admin-test'}}'; can't understand '{'spec.selector': {u'app': 'admin-test'}}'",
"code": 500
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Field Selectors - Kubernetes
Using unsupported field selectors produces an error. For example: kubectl get ingress --field-selector foo.bar=baz.
Read more >How to use Kubernetes fieldSelector to query ownerReferences
The --field-selector only works with some limited fields. Which contains: "metadata.name", "metadata.namespace", "spec.nodeName", "spec.
Read more >How to use `FieldSelector`? How to filter Services service-side?
namespace or metadata.name as FieldSelector . Am I using this incorrectly? Is there a way to filter (e.g. Services) service-side like this? I've ......
Read more >Kubernetes Label Selector and Field Selector - MayaData Blog
In this blog, I will explain how label and field selectors will help you in understanding how they work and how they can...
Read more >Field Selectors - Kubernetes
Using unsupported field selectors produces an error. For example: $ kubectl get ingress --field-selector foo.bar=baz Error from server ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I ran into this as well.
Reading the docs shows it is a str, but doesn’t give a good, valid, example of it anywhere.
This gets appended to a dictionary of items to pass into a raw request call down the line, in which kubernetes expects it in the form of ‘key=value’. So, for example, if I’m trying to find a secret named
star-cert
, the following should return the object:Dose field_selector support regex?