k8s - deployment with service dependency

3/19/2019

I was playing with k8s deployment - rolling update and it works really well. I am curious to know how to do deployment when we have a service dependency! Not sure If i am explaining my question correctly. It is just a very high level scenario!

Lets consider this example. I have deployed 2 apps with 10 replicas each, exposed as services.

Service-A
  Deployment-A
    Pod-A - v1 - (10)

Service-B
  Deployment-B
    Pod-B - v1 - (10)

Service A depends on B. Now as part of v2 release both apps need to use v2. Service B api expects few additional parameters / slightly changed. When we upgrade both apps with newer version v2, if service-B becomes up and running before Service-A, some of the requests would be failing as Service-A is still in v1 (as the upgrade is in progress). How can we do the deployment without any failure here? if you are using k8s already, what is the best practice you would follow.

-- KitKarson
kubernetes
kubernetes-deployment

1 Answer

3/19/2019

As shown in "Enable Rolling updates in Kubernetes with Zero downtime" from Nilesh Jayanandana, you could check if implementing a readiness probe would help service B to wait for service A being in V2.

Another approach would be through an Helm package, as in "Deploy, Scale and Upgrade an Application on Kubernetes with Helm", which can modelize the dependency, and then, through helm update, perform the rolling upgrade.

-- VonC
Source: StackOverflow