Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

219
Visualizações
How to wait until EXTERNAL-IP is assigned?

When I deploy https://projectcontour.io/ ingress controller on my Digital Ocean K8S cluster, a load balancer gets created automatically.

I consider to use Ansible as management tool for K8S to automate the deployment.

After the following tasks:

- name: retrieve file
  get_url:
    url: https://projectcontour.io/quickstart/contour.yaml
    dest: /testing/contour.yaml
  register: download_contour

- name: create deployment
  k8s:
    src: /testing/deployment.yml
  when: download_contour.changed

I would like to wait until the contour gets EXTERNAL-IP address assigned, then continue with other tasks. Here is an example on my local computer:

kubectl get -n projectcontour service envoy -o wide                                                                       
NAME    TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)                      AGE     SELECTOR
envoy   LoadBalancer   10.96.226.84   172.18.255.200   80:31092/TCP,443:30362/TCP   2d15h   app=envoy

How to wait until the envoy LoadBalancer gets the EXTERNAL-IP address assigned in Ansible?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I haven't tested it, but I think you could try to do something like this:

- shell: if [[ $(kubectl get services envoy -n projectcontour --output jsonpath='{.status.loadBalancer.ingress[0]}') ]]; then exit 0; else exit 1; fi;
  register: wait_for_ext_ip
  until: wait_for_ext_ip.rc == 0
  retries: 10
  delay: 5
over 4 years ago · Santiago Trujillo Relatório

0

You should use the until loops:

tasks:
  - name: run kubectl to retreive external IP - Wait for task to complete
    shell: "kubectl get -n projectcontour service envoy -o wide | awk '{ print $4}' |  grep -v EXT"
    register: k_ext_ip
    until: k_ext_ip.stdout.find("1.2.3.4") != -1
    retries: 6
    delay: 10

For the shell command, I simply used some basic linux commands. It's better to replace those with Kubectl aligned commands to view only the EXTERNAL-IP.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda