Approaches for Releasing and Restarting Microservice(s)

Created by Shafeen Panjwani, Modified on Mon, 24 Jul, 2023 at 4:17 PM by Shafeen Panjwani

Agenda 

The KBA will help in defining the steps to be followed by the infrastructure teams for new releases

Target Audience 

Infrastructure Team

Release

The following are the types of releases:

  • Type 1: Releasing new microservice

    • In order to release a new microservice, run the following command:
      kubectl apply -f <<yaml file name>>

  • Type 2: Code change to existing microservice

    • The following steps can be followed in this case:

      • Make sure the image has a different tag.

      • Open the deployment using:
        kubectl edit deploy <<deploymentName>> -n <<namespace>>

      • Locate where the image is specified and edit the tag.

      • Save it and exit. The pod will be automatically restarted.

  • Type 3: Restarting a microservice due to changes in configMap

    • Make the changes in the configMap. Once done, restart the pod(s) using the following command:

      • When the microservice scaling is 1:
        kubectl delete po <<podName>> -n <<namespace>>
        (you can get the podName by running  kubectl get po -n <<namespace>>)

      • When the microservice scaling is >=1:
        kubectl rollout restart deploy <<deployment name>> -n <<namespace>>
        (you can get the deployment name by running- kubectl get deploy -n <<namespace>>)

Infra Activity

The following are the possible infra activity types:

  • Type 1: Stop and start all the microservice

    • The following steps can be followed:

      • kubectl scale deploy -n <<namespace>> --replicas 0 --all

      • Note: Before running this command, please note the replicas count for each microservice using the command - kubectl get deploy -n <<namespace>>

      • kubectl scale deploy -n <<namespace>> --replicas 1 --all

      • Individual microservices can be scaled to the respective numbers as noted down in step 1:

kubectl scale deploy <<deploymentName>> -n <<namespace>> --replicas <<number>>

  • Multiple deployments can be scaled at once:

kubectl scale deploy <<deploymentName1>> <deploymentName2>> -n <<namespace>> --replicas <<number>>

Ex: kubectl scale deploy bff bpm mdm -n appveensit --replicas 5

Type 2: Restarting all the microservices

The following command can be used:

kubectl delete po -n <<namespace>> --all


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article