kubernetes-python-client

How to programmatically modify a running k8s pod status conditions?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-11 12:01:40
问题 I'm trying to modify the running state of my pod, managed by a deployment controller both from command line via kubectl patch and from the k8s python client API. Neither of them seem to work From the command line, I tried both strategic merge match and JSON merge patch, but neither of them works. For e.g. I'm trying to patch the pod conditions to make the status field to False kubectl -n foo-ns patch pod foo-pod-18112 -p '{ "status": { "conditions": [ { "type": "PodScheduled", "status":

How to apply patch to make pod phase go to Succeeded or Failed?

我是研究僧i 提交于 2020-12-15 05:23:27
问题 This is a follow-up from my last question - How to programmatically modify a running k8s pod status conditions? after which I realized, you can only patch the container spec from the deployment manifest to seamlessly let the controller apply the patch changes to the pods through the ReplicaSet it created. Now my question is how to apply patch to make the Pod phase to go to Succeeded or Failed . I know for e.g. for pod phase to go to Succeeded , all the containers need to terminate

How to apply patch to make pod phase go to Succeeded or Failed?

时光毁灭记忆、已成空白 提交于 2020-12-15 05:23:27
问题 This is a follow-up from my last question - How to programmatically modify a running k8s pod status conditions? after which I realized, you can only patch the container spec from the deployment manifest to seamlessly let the controller apply the patch changes to the pods through the ReplicaSet it created. Now my question is how to apply patch to make the Pod phase to go to Succeeded or Failed . I know for e.g. for pod phase to go to Succeeded , all the containers need to terminate

Why shouldn't you run Kubernetes pods for longer than an hour from Composer?

偶尔善良 提交于 2020-02-01 05:47:05
问题 The Cloud Composer documentation explicitly states that: Due to an issue with the Kubernetes Python client library, your Kubernetes pods should be designed to take no more than an hour to run. However, it doesn't provide any more context than that, and I can't find a definitively relevant issue on the Kubernetes Python client project. To test it, I ran a pod for two hours and saw no problems. What issue creates this restriction, and how does it manifest? 回答1: I'm not deeply familiar with

How to create secrets using Kubernetes Python client?

白昼怎懂夜的黑 提交于 2020-01-15 11:53:41
问题 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 <module> api_response = v1.create_namespaced_secret(namespace, body) File "/usr/local/lib/python3.6/site-packages/kubernetes/client/apis/core_v1_api.py", line 7271, in create_namespaced_secret (data) = self.create_namespaced_secret_with_http_info(namespace, body, **kwargs) File "/usr

Airflow k8s operator xcom - Handshake status 403 Forbidden

别等时光非礼了梦想. 提交于 2019-12-22 10:44:46
问题 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 encountered: [2018-12-18 05:29:02,209] {{models.py:1760}} ERROR - (0) Reason: Handshake status 403 Forbidden Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/kubernetes/stream/ws_client.py", line 249, in websocket_call

Having problem in authenticating kubernetes python client

匆匆过客 提交于 2019-12-13 03:44:09
问题 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 = 'LS0XXXXXXXXXS0tLQo=' configuration.api_key['authorization'] = 'ZXXXXXXXXXXdw==' configuration.api_key_prefix['authorization'] = 'Bearer' configuration.host = 'https://aaaaaaaaaaaaaaa.gr7.us-east-1.eks.amazonaws.com' #configuration.verify_ssl = False api_instance =

Airflow k8s operator xcom - Handshake status 403 Forbidden

老子叫甜甜 提交于 2019-12-06 01:37:28
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 encountered: [2018-12-18 05:29:02,209] {{models.py:1760}} ERROR - (0) Reason: Handshake status 403 Forbidden Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/kubernetes/stream/ws_client.py", line 249, in websocket_call client = WSClient(configuration, get_websocket_url(url), headers) File "/usr/local/lib/python3.6/site

Kubernetes python client: authentication issue

时光总嘲笑我的痴心妄想 提交于 2019-11-27 02:55:09
问题 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, attach to the the logs and report the end status of the pod looks as follows: config.load_kube_config(persist_config=False) v1 = client.CoreV1Api() v1.create_namespaced_pod(body=pod_specs_dict, namespace=args.namespace) logging_response = v1.read