gokubernetes-operatoroperator-sdk

Build a Kubernetes Operator For rolling updates


I have created a Kubernetes application (Say deployment D1, using docker image I1), that will run on client clusters.

Requirement 1 :

Now, I want to roll updates whenever I update my docker image I1, without any efforts from client side (Somehow, client cluster should automatically pull the latest docker image)

Requirement 2:

Whenever, I update a particular configMap, the client cluster should automatically start using the new configMap

How should I achieve this ?

  1. Using Kubernetes Cronjobs ?
  2. Kubernetes Operators ?
  3. Or something else ?

I heard that k8s Operator can be useful


Solution

  • Starting with the Requirement 2:

    Whenever, I update a particular configMap, the client cluster should automatically start using the new configMap

    If configmap is mounted to the deployment it will get auto-updated however if getting injected as the Environment restart is only option unless you are using the sidecar solution or restarting the process.

    For ref : Update configmap without restarting POD

    How should I achieve this ?

    Using Kubernetes Cronjobs ?

    Kubernetes Operators ?

    Or something else?

    If you just looking for updating the deployment, Go with running the API in the deployment or Job you can schedule in a controlled manner, no issue with the operator too would be a more native and a good approach if you can create, manage & deploy one.

    If in the future you have a requirement to manage all clusters (deployment, service, firewall, network) of multiple clients from a single source of truth place you can explore the Anthos.

    Config management from Git repo sync with Anthos