Questions tagged [kubernetes-python-client]
93 questions
0
votes
1 answer
How to use kubernetes python sdk to redeploy a deployment
version info:
python3.7
kubernetes==8.0.0
doc: https://github.com/kubernetes-client/python/tree/release-8.0/kubernetes
I only found the update API, not the redeploy API。
thanks

liyao
- 5
- 2
0
votes
1 answer
Is there a way to automatically launch a followup (different) job only if a Kubernetes job fails?
Context:
I currently have a Python Flask app which when receives a request, it automatically creates a Kubernetes job to run a process. Once the job finishes, it posts back the results to a specific endpoint (never changes). Depending on the…

kpetrou
- 371
- 3
- 3
0
votes
0 answers
how to pass patch type in patch_namespaced_deployment function in python kubernetes client?
I need help in patch_namespaced_deployment function in python kubernetes client, how i can pass patch type in this function. I want to use MergePatchType for patching the deployment.
api_instance.patch_namespaced_deployment(name, namespace, body,…

vivek grover
- 1
- 3
0
votes
1 answer
Feed Python Kubernetes client with heredoc instead of filepath
Is there a simple way to create a configuration object for the Python Kubernetes client by passing a variable containing the YAML of the kubeconfig?
It's fairly easy to do something like:
from kubernetes import client, config, watch
def main():
…

ccamacho
- 707
- 8
- 22
0
votes
1 answer
Python Kubernetes client equivalent of kubectl describe pod | grep Events
I'm creating a custom monitoring script for my self hosted kubernetes cluster on AWS. Among all other tools, Python client was of much interest for me. I have got a dictionary of pod and their status. Now I want to iterate the dict.keys (the pods in…

jagatjyoti
- 699
- 3
- 10
- 29
0
votes
3 answers
How to use a multiple kubernetes resource file through kubernetes python client similar to kubectl apply -f
I have a kubernetes multi-resource file which contains different resources that are to be applied for e.g. deployment-definition, service-defintion, pv, pvc etc. Is there any way to use this single file through kubernetes python client to deploy all…

Vedant Pareek
- 391
- 3
- 9
0
votes
1 answer
Remove volumeMount on pvc delete
My usecase is as follows:
I have a deployment for a multi-tenant service. This deployment has many mountVolumes associated with it, which are pvcs specific to a tenant. When I delete a tenant, I want to delete the associated pvc as well. And in turn…

Anjana
- 1
- 4
0
votes
1 answer
K8S API access with client certificate using python client
My purpose is to access my k8s API from a remote server using python client and client certificate, which is working with curl like this:
curl --key /XXX/XXX.key --cert /XXX/XXX.crt --cacert /XXX/XXX.crt …

Georgios
- 33
- 1
- 5
0
votes
3 answers
How to connect to microk8s API through Python Kubernetes client?
I'm trying to connect to my microk8s Kubernetes cluster which is listening on port 16443 with the Python Kubernetes client:
#!/usr/bin/python3
import kubernetes
from kubernetes import client
from kubernetes.client import ApiClient
def…

Kalle Richter
- 8,008
- 26
- 77
- 177
0
votes
1 answer
Unauthorized response when using service account bearer token
from __future__ import print_function
import kubernetes
import time
import kubernetes.client
from kubernetes.client.rest import ApiException
from pprint import pprint
def create():
print ("begin");
configuration =…

Chris Stryczynski
- 30,145
- 48
- 175
- 286
0
votes
0 answers
How to create a request in python insecure by header
I want to request to show my pods in kubsernets
and this command work for me
curl -X GET https://203.0.113.106:6443/api --header "Authorization: Bearer $TOKEN" --insecure
{
"kind": "APIVersions",
"versions": [
"v1"
],
…

check nova
- 271
- 1
- 2
- 11
0
votes
2 answers
Kubernetes python client: authentication problem
I am trying to use the python API for kubernetes and I can't seem to be able to execute the request. I think the pipeline is not clear to me.
I am following the steps here: Kubernetes python client: authentication issue
On the remote server:
I…

Ademord
- 31
- 1
- 6
0
votes
1 answer
In kubernetes python client, curl command returns the output in str and I am expecting output in json format
I am creating a program in kubernetes python client, and which curls an url inside the pod and expect the output in json, instead the output comes in form of str. Following is my program:
from kubernetes import client, config, watch
from…

Prafull Ladha
- 12,341
- 2
- 37
- 58
0
votes
0 answers
Pycharm lack of Intelisense for nested class properties
I'm using kubernate client to get the nodes list like this way.
obj = KubeApiHelper("default")
nodeList = obj.get_nodes_list()
for node in nodeList.items:
print node.**status.conditions**
the line I bold I lack of Intelisense helper from IDE.
I…

Patryk
- 39
- 7
0
votes
2 answers
Is it possible to watch all the events on a Kubernetes cluster using the python API?
Using the kubernetes Python API< you have to specify the events to watch? Is it possible to watch all events in the cluster

clout_chaser
- 3
- 1
- 6