Questions tagged [kubernetes-python-client]
93 questions
1
vote
1 answer
How to make kubernetes.client.api.batch_v1_api.BatchV1Api.delete_namespaced_job wait till deletion is complete
I delete and re-submit a job with the same name, and I often get a 409 HTTP error with a message that says that the object is being deleted -- my submit comes before the job object is removed.
My current solution is to spin-try until I am able to…

Anton Daneyko
- 6,528
- 5
- 31
- 59
1
vote
1 answer
Closing client connection to kubernetes API server in python client
I am using kubernetes-client library in python and looking at the various examples, it appears we don't need to explicitly close the client connection to the API server. Does the client connection gets terminated automatically or are the examples…

Krishna Chaurasia
- 8,924
- 6
- 22
- 35
1
vote
1 answer
How to set Active namespace in Kubernetes using python
I am working on kubernetes API on python. We use the same namespace everytime. So I thought of setting the name form python itself. But I could not find any relevant documentation on how to set active namespace in kuebernetes API in python. Can…

Mohammed Shuaib
- 21
- 3
1
vote
1 answer
Create a pod using kubernetes SDK for python
I want to create a pod with the python client SDK (similar to kubectl run) that gives me results like the below:
kubectl run --rm --image $IMAGE --overrides="$OVERRIDES" --generator=run-pod/v1 -ti "$POD"
Any good examples? I can see some examples…

mohab
- 78
- 10
1
vote
0 answers
Kubernetes python client: Response issue over threading
I'm trying to get a list of unhealthy pods in the Kubernetes cluster and then trying to watch the events for message, put them to a list and report. However, I'm not able to get response back for all the threads. The response is pretty unusual,…

jagatjyoti
- 699
- 3
- 10
- 29
1
vote
2 answers
Connecting to MongoDB in Kubernetes pod with kubernetes-client using Python
I have a MongoDB instance running on Kubernetes and I'm trying to connect to it using Python with the Kubernetes library.
I'm connecting to the context on cmd line using:
kubectl config use-context CONTEXTNAME
With Python, I'm using:
from…

FrancesSun
- 33
- 1
- 12
1
vote
2 answers
How to reduce the retry count for kubernetes cluster in kubernetes-client-python
I need to reduce the retry count for unavailable/deleted kubernetes cluster using kubernetes-client-python, currently by default it is 3.
WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken…

tathagatk22
- 11
- 4
1
vote
2 answers
Having problem in authenticating kubernetes python client
my lisNamespaces.py file
from __future__ import print_function
import time
import kubernetes.client
from kubernetes.client.rest import ApiException
configuration = kubernetes.client.Configuration()
configuration.ssl_ca_cert =…

naveen kumar
- 307
- 2
- 11
1
vote
3 answers
Kubernetes Python client returns pod's JSON HTTP response from proxy verb as string with single quotes instead of double quotes
I'm requesting some JSON data from a pod's web server via the Kubernetes API proxy verb. That is:
corev1 = kubernetes.client.CoreV1Api()
res = corev1.connect_get_namespaced_pod_proxy_with_path(
'mypod:5000', 'default', path='somepath',…

TheDiveO
- 2,183
- 2
- 19
- 38
1
vote
1 answer
Not able to delete kubernetes ingress-object through kubernetes python client
I am getting this error while deleting the ingress objects.
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '161', 'Date': 'Wed, 14 Feb 2018 10:14:03 GMT'})
HTTP response…

Abhishek
- 551
- 2
- 5
- 22
0
votes
0 answers
Calling NetworkingV1Api().list_namespaced_ingress(namespace=namespace) raises AttributeError
I'm using kubernetes python client library to list all ingresses in a namespace. I'm using the api NetworkingV1Api(). When i run the code, its throwing the error "AttributeError: 'NetworkingV1Api' object has no attribute…

Venu Madhav
- 1
- 1
0
votes
0 answers
Kubernetes kubectl cluster-info gives connection to the server localhost:8080 was refused
I'm new to the kubernetes and
I'm using ubuntu 20.04 aarch64 remote server,
kubectl version command gives an error
The connection to the server localhost:8080 was refused - did you specify the right host or port?
I don't know whats going…

Shubham Nikam
- 70
- 7
0
votes
1 answer
Is there a way to get all namespace scoped resource objects by label selector using python kubernetes client?
I want to achieve this command use kubernetes python client.
kubectl -n namespace get all -l key=value
I've seen several questions here List all resources in a namespace using the Kubernetes python client
but it's means
kubectl api-resources
not…

romlym
- 561
- 1
- 7
- 26
0
votes
1 answer
Using flask socketio to follow kubernetes pod
I am trying to send kubernetes pod logs using socketio websocket to client, I can see the print(line_str) but socket cannot connect and cannot recieve anything under log_line event
@socketio.on('connect', namespace='/ws-connect')
def…

aekiratli
- 518
- 7
- 18
0
votes
0 answers
Getting- "Upgrade request required error" when using connect_get_namespaced_pod_exec
I am trying to use kubernetes python client to execute a script inside, say podA from another pod, say podB, using the connect_get_namespaced_pod_exec method. Which is throwing this error:
Traceback (most recent call last):
File "/route.py", line…

learner123
- 1
- 1