Questions tagged [kubernetes-python-client]
93 questions
                    
                    15
                    
            votes
                
                3 answers
            
        Kubernetes python client: authentication issue
We are using the kubernetes python client (4.0.0) in combination with google's kubernetes engine (master + nodepools run k8s 1.8.4) to periodically schedule workloads on kubernetes. The simplified version of the script we use to creates the pod,…
         
    
    
        krelst
        
- 491
- 1
- 4
- 13
                    12
                    
            votes
                
                3 answers
            
        Where can i get the API_KEY in Kubernetes installation
Have been trying to get the python client for kubernetes work as expected. Had good luck with config.load_kube_config()
Now i'd like to use the Python client from a remote machine which neither has kubectl nor ~/.kube/config on it. Tried the python…
         
    
    
        papu
        
- 405
- 5
- 14
                    10
                    
            votes
                
                3 answers
            
        Copy file from pod to host by using kubernetes python client
I need to copy a file from a pod to the host by using kubernetes python client. It would be something like kubectl cp pod:file file.
I'm testing the code from:…
         
    
    
        Jorgese
        
- 551
- 6
- 14
                    8
                    
            votes
                
                2 answers
            
        Kubernetes Python client connection Issue
I have setup Official Kubernetes Python Client (https://github.com/kubernetes-client/python).
I am running Python code to connect to a Kubernetes cluster and it's throwing an error:
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='****',…
         
    
    
        Mahendra D
        
- 191
- 2
- 6
                    8
                    
            votes
                
                2 answers
            
        Airflow k8s operator xcom - Handshake status 403 Forbidden
When I run a docker image using KubernetesPodOperator in Airflow version 1.10
Once the pod finishes the task successfullly, airflow tries to get the xcom value by making a connection to the pod via k8s stream client.
Following is the error which I…
         
    
    
        Deep Nirmal
        
- 1,141
- 1
- 15
- 14
                    7
                    
            votes
                
                1 answer
            
        accessing kubernetes python api through a pod
so I need to connect to the python kubernetes client through a pod. I've been trying to use config.load_incluster_config(), basically following the example from here. However it's throwing these errors. 
  File…
         
    
    
        helloworld
        
- 399
- 3
- 9
- 21
                    6
                    
            votes
                
                2 answers
            
        How to read a Kubernetes Deployment with python kubernetes client
what is python kubernetes client equivalent for
kubectl get deploy -o yaml 
CRUD python Client example
i referred this example for getting python deployment
but there is no read deployment option
         
    
    
        Pradeep Padmanaban C
        
- 618
- 9
- 23
                    5
                    
            votes
                
                1 answer
            
        Kubernetes python client equivalent of "kubectl wait --for " command
I am using kubernetes-client/python and want to write a method which will block control until a set of Pods is in Ready state (Running state). I found that kubernetes supports wait --for command for doing same thing via command. Can someone please…
         
    
    
        Taj Uddin
        
- 373
- 4
- 14
                    5
                    
            votes
                
                2 answers
            
        Approve a CSR in Kuberentes Using the Python client
I have the following CSR object in Kubernetes:
$ kubectl get csr
NAME                                     AGE       REQUESTOR                                      CONDITION
test-certificate-0.my-namespace          53m      …
         
    
    
        licorna
        
- 5,670
- 6
- 28
- 39
                    4
                    
            votes
                
                1 answer
            
        Remove volume from deployment using patch_namespaced_deployment not working
I'm trying to patch a deployment and remove its volumes using patch_namespaced_deployment (https://github.com/kubernetes-client/python) with the following arguments, but it's not working.
patch_namespaced_deployment(
           …
         
    
    
        Mehdi Khlifi
        
- 405
- 8
- 21
                    4
                    
            votes
                
                1 answer
            
        I need to get number of Pods in a Kubernetes Cluster with kubernetes python client
i have a code to get the number of Pods it give the output but it loads too many unwanted data in (ret_pod), is there a better way to do it?
from  kubernetes import client , config 
config.load_kube_config()
v1= client.CoreV1Api()
ret_pod =…
         
    
    
        Pradeep Padmanaban C
        
- 618
- 9
- 23
                    4
                    
            votes
                
                1 answer
            
        How to create secrets using Kubernetes Python client?
I have been trying to play around with creating secrets for Kubernetes cluster using the python client. I keep getting an error that says
Traceback (most recent call last):
File "create_secrets.py", line 19, in 
api_response =… 
         
    
    
        blo0old
        
- 115
- 1
- 2
- 7
                    3
                    
            votes
                
                2 answers
            
        kubernetes python client: block and wait for child pods to dissappear when deleting deployment
I'm looking to use the Kubernetes python client to delete a deployment, but then block and wait until all of the associated pods are deleted as well. A lot of the examples I'm finding recommend using the watch function something like follows.
try:
 …
         
    
    
        Joe J
        
- 9,985
- 16
- 68
- 100
                    3
                    
            votes
                
                3 answers
            
        I need to get resource usage of Pods in a Kubernetes Cluster with kubernetes python client
i have linux command to get the resource usage of the pods in particular namespace what is the equivalent python command for it
$ kubectl top pod
NAME                                CPU(cores)   MEMORY(bytes)   
nginx-deployment-7fd6966748-57mt5  …
         
    
    
        Pradeep Padmanaban C
        
- 618
- 9
- 23
                    3
                    
            votes
                
                0 answers
            
        Equivalent of 'kubectl cluster-info' in kubernetes python client?
Is there any equivalent kubernetes python client function for
kubectl cluster-info
which output
Kubernetes master is running at https://192.x.x.x:8443
KubeDNS is running at…
         
    
    
        Nidhin
        
- 628
- 7
- 16