How to configurate on kubernetes to update from git repository?

7/1/2021

I just installed bitnami/wordpress image using helm. Is it possible to sync it with git and when I will change some files in this git repository to update kubernetes pods?

I mean update Wordpress source code because Im modyficating plugins in wp-content/plugins dir.

-- Don Don Don
bitnami
cloud
kubernetes
kubernetes-helm
wordpress

3 Answers

7/1/2021

One way I managed it (although possibly a rookie way) was through github actions.

Here's an example of mine
And here's official docs from docker to configure with github actions
You basically want to tell github actions to recreate and push your image and then tell your cluster to refresh like so:

If you're using kubectl to manage your cluster check if your version supports kubectl rollout restart. You can use it to force any deployment to restart and smoothly recreate your pods (it also re-pulls the supporting image). e.g.: kubectl rollout restart deployment/my_deployment

-- Orfeas Zografos
Source: StackOverflow

7/1/2021

You can use ArgoCD or Flux to automate this types of GitOps workflow. Check their documentation. They are pretty powerful and popular for GitOps in Kubernets.

-- Emruz Hossain
Source: StackOverflow

7/1/2021

A possible solution is to use git-sync in a sidecar container. It will periodically pull files down from a repository and copy them to a volume.

Here is a sample manifest which uses git-sync to update the content hosted on a simple nginx web server: https://github.com/nigelpoulton/ps-vols-and-pods/blob/master/Multi-container-Pods/sidecar.yml

-- Arnaud Develay
Source: StackOverflow