Kubernetes gitrepo volume - auto redeploy?

3/26/2018

I have created a deployment with two replicas in my K8S cluster with the volumes section to clone a git repo. The repo is cloned, the pods are created, deployment is created. I can login to the pod and run git commits are things look ok.

My assumption: If I do a git push to the repository managed by gitRepo volume mount, the pod or K8S deployment will be automatically redeployed but this is not happening? Is my assumption wrong? Should I do something more to do an auto-redeploy once a push is done like a CD pipeline? If the latter is true, I am trying to understand the purpose of gitRepo volume mounts now.

Thanks for your inputs.

Abdul.

-- Basith
git
kubectl
kubernetes
kubernetes-deployment

1 Answer

3/27/2018

After some research, I think I understand the scope of gitRepo volumes now. My requirement to auto-update the pods/deployments when changes happen to git repo can be handled using a microservice such as this: https://github.com/fabric8io/gitcontroller

The issues with the above microservice:

  1. Not able to find the gitcontroller binary (look at the GitHub issues as well, someone had posted this earlier)
  2. When I try to build this manually after installing Go and moving the microservice to the desired location that it expects, I finally run into memory errors.

So I believe the above microservice is broken and not probably maintained now (as of writing). Until it's fixed, I am going back to using Spring Cloud Config server with git backed repo to handle my configs. So when my configs change, I can run the Fabric8 maven plugin (https://maven.fabric8.io/) to build a new Docker image and deploy that in my cluster. All of this can be automated using a simple Jenkins CD pipeline.

-- Basith
Source: StackOverflow