1

I have a namespace namespace - which has ~10-15 deployments. Creating a big yaml file, and apply it on a "deploy".

How do i validate, wait, watch, block, until all deployments have been rolledout ?

currently i am thinking of:

  • get list of deployments
  • foreach deployment - make api call to get status
  • once all deployments are "green" - end process, signaling deployment/ship is done.

what are the status'es of deployments, is there already a similar tool that can do it? https://github.com/Shopify/kubernetes-deploy is kind of what i am searching for, but it forces a yml structure and so on.

what would be the best approach?

4 Answers 4

2

Set a readiness probe and use kubectl rollout status deployment <deployment_name> to see the deployment rollout status

Sign up to request clarification or add additional context in comments.

Comments

1

You'd better use Helm for managing deployments. Helm allows you to create reusable templates that can be applied to more than one environment. Read more here: https://helm.sh/docs/chart_template_guide/#getting-started-with-a-chart-template

You can create one big chart for all your services or you can create separate Helm charts for each your service.

Helm also allows you to run tests after deployment is done. Read more here: https://helm.sh/docs/developing_charts/#a-breakdown-of-the-helm-test-hooks

1 Comment

read about helm, however i am already having my tooling with custom templating and stuff -> resulting in one large yml file. i don't want to introduce yet a another complex thing. but in generall if started from scratch "helm" might be an option. but it boils down to "how do i get the overall status of N deployments"
1

You probably want to use kubectl wait https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#wait

It lets you wait for a specific condition of a specific object In your case:

kubectl -n namespace \
             wait --for=condition=Available --timeout=32s \     
             deployment/name

1 Comment

but that would require one kubectl per deployement? right?
0

use --dry-run option in the apply/create command to check the syntax.

1 Comment

its not about the syntax, i know its correct, apply changes the image: which introduces a pull and re-create - which takes time, depending on the size of the change, and i want to know once the "deployment" is done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.