Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

407
Views
Cliente de Kubernetes python equivalente al comando "kubectl wait --for"

Estoy usando kubernetes-client/python y quiero escribir un método que bloquee el control hasta que un conjunto de Pods esté en estado Listo (estado En ejecución). Descubrí que kubernetes admite el comando wait --for para hacer lo mismo a través del comando. ¿Puede alguien ayudarme con la forma de lograr la misma funcionalidad usando el cliente Python de Kubernetes?

Para ser precisos, estoy principalmente interesado en el equivalente de-

 kubectl wait --for condition=Ready pod -l 'app in (kafka,elasticsearch)'
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede utilizar la funcionalidad de watch disponible en la biblioteca del cliente.

 from kubernetes import client, config, watch config.load_kube_config() w = watch.Watch() core_v1 = client.CoreV1Api() for event in w.stream(func=core_v1.list_namespaced_pod, namespace=namespace, label_selector=label, timeout_seconds=60): if event["object"].status.phase == "Running": w.stop() end_time = time.time() logger.info("%s started in %0.2f sec", full_name, end_time-start_time) return # event.type: ADDED, MODIFIED, DELETED if event["type"] == "DELETED": # Pod was deleted while we were waiting for it to start. logger.debug("%s deleted before it started", full_name) w.stop() return
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!