This is a creation in Article, where the information may have evolved or changed. 
 
 
 
 
 
 
 
 Objective 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 have been thinking of deploying applications to k8s posture, previously introduced helm, personal feeling helm put the record data in k8s not particularly good. Weave's flux project was recently discovered (a tool for deploying container images to Kubernetes services). 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 About Flux 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 First, take a general look at the concept of flux. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 1:flux can be paired with any CI tool you like, such as DRONE,CIRCLECI,GITLABCI. In fact, Flux made the CD link. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 2:flux can help you to safely update your app. In general, there is an error in the update process, and in the flux implementation, the YAML files for each deployed application are stored in the Git repository , so each change can be traced so that it can be rolled back to any historical version. I feel very good about this. When the application needs to update the image, there are several steps: 
 
 
 
 
 
 
 
 
 
 
 Clone the Repository 
 
 Find the deployment files that with the image in question (there is more than one, since we have e.g., sidecar containe RS that use the same image) 
 
 Update a few fields in each file, with slightly different ways (e.g., put the image name in the template, and the tag part O f the image name in a version label) 
 
 Commit and push the change back to Git 
 
 
 
 
 
 
 
 If you just update the image, there is a simpler operation: 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 $ fluxctl release --service=sock-shop/front-end --update-all-images 
 
 Submitting release job... 
 
 Release job submitted, ID cc08f78c-0e66-24a9-9215-82c80cc646c3 
 
 Status: Complete. 
 
 Here's what happened: 
 
 1. Submitted job. 
 
 2. Calculating release actions. 
 
 3. Release latest images to sock-shop/front-end 
 
 4. Clone the config repo. 
 
 5. Clone OK. 
 
 6. Update 1 images(s) in the resource definition file for sock-shop/front-end: front-end (weaveworksdemos/front-end:0.2.0 -> weaveworksdemos/front-end:7f511af2d21fd601b86b3bed7baa6adfa9c8c669). 
 
 7. Update pod controller OK. 
 
 8. Commit and push the config repo. 
 
 9. Pushed commit: Release latest images to sock-shop/front-end 
 
 10. Regrade 1 service(s): sock-shop/front-end. 
 
 Took 55.810622454s 
 
 
 
 
 
 
 
 
 
 
 
 
 
 The idea of combining with drone is drawn here. This is explained in detail in the summary. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 3:flux is a good solution to the problem of visualization, through a few instructions will be able to clearly know what is happening. Flux has the concept of controller. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 $ fluxctl list-services --namespace=sock-shop 
 
 SERVICE                 CONTAINER   IMAGE                           RELEASE  POLICY 
 
 sock-shop/cart          cart        weaveworksdemos/cart:0.3.0                   
 
 sock-shop/cart-db       cart-db     mongo                                         
 
 sock-shop/catalogue     catalogue   weaveworksdemos/catalogue:0.2.0               
 
 sock-shop/catalogue-db  catalogue-db  weaveworksdemos/catalogue-db:0.2.0         
 
 sock-shop/front-end     front-end   weaveworksdemos/front-end:0.2.0               
 
 sock-shop/orders        orders      weaveworksdemos/orders:0.3.0                 
 
 sock-shop/orders-db     orders-db   mongo                                         
 
 sock-shop/payment       payment     weaveworksdemos/payment:0.3.0                 
 
 sock-shop/queue-master  queue-master  weaveworksdemos/queue-master:0.3.0         
 
 sock-shop/rabbitmq      rabbitmq    rabbitmq:3                                   
 
 sock-shop/shipping      shipping    weaveworksdemos/shipping:0.3.0               
 
 sock-shop/user          user        weaveworksdemos/user:0.3.0                   
 
 sock-shop/user-db       user-db     weaveworksdemos/user-db:0.3.0 
 
 
 
 
 
 
 
 $ fluxctl list-images --service=sock-shop/front-end 
 
 SERVICE             CONTAINER  IMAGE                                  CREATED 
 
 sock-shop/front-end  front-end  weaveworksdemos/front-end                     
 
                     |   7f511af2d21fd601b86b3bed7baa6adfa9c8c669  18 Nov 16 16:00 UTC 
 
                     |   latest                                    18 Nov 16 16:00 UTC 
 
                     |   snapshot                                  18 Nov 16 16:00 UTC 
 
                     |   16007dddd86b2ebb41d8880c53b77580cab13f02  18 Nov 16 11:23 UTC 
 
                     |   a0eaf8c8ffc0b81c2199adaf7d67466891bb3205  17 Nov 16 10:22 UTC 
 
                     |   1b664cc81d9cf25b213000686a9e8d6477ae1b06  16 Nov 16 20:31 UTC 
 
                     |   ce1efe59c32d3c53344defdda4d5b643272022b8  16 Nov 16 20:29 UTC 
 
                     |   4c33b216ae902ad89b9c3ca30a99a44833d16d5b  10 Nov 16 21:34 UTC 
 
                     |   7015587783bc8f7a9c3d5cfa51e5a257fe188c4b  10 Nov 16 11:34 UTC 
 
                     |   4d3ea2896c81e40a630d36cdc29ce740e7617016  10 Nov 16 11:30 UTC 
 
                     :                                           
 
                     '-> 0.2.0                                     09 Nov 16 10:26 UTC 
 
 
 
 
 
 
 
 
 
 
 4:flux can actually automatically detect changes in the Yaml file in the Git repository and update the images in the registry. 
 
 It is most useful when used as a deployment tool at the end of a continuous Delivery pipeline. Flux would make sure this your new container images and config changes is propagated to the cluster. 
 
 The main idea is that using flux as the last link in CD pipeline can be a good solution to the image update or YAML file update. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Summarize 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 1: How to combine with drone? 
 
 First of all, I'm endorsing yaml to be stored in a git repository for versioning. 
 
 In fact, Flux is similar to helm, which is divided into fluxd and a command-line tool FLUXCTL,FLUXD equivalent to server deployment in a k8s cluster. Then make the fluxctl into a drone plugin. The last step in the drone pipeline. Similar to the current gameplay of many Helm plugins. 
 
 This plugin only needs to complete the function of updating the image. After all, the whole pipeline, the update code to the Repository trigger compilation, build, push the new image to harbor, eventually for the k8s cluster, only need to replace the new image of the application. So do not need to listen to registry this function. There's no need to focus on the changes in Yaml in Git and pull up the latest. 
 
 Concrete Realization Idea: 
 
 
 
 
 
 
 
 
 
 
 The new mirror name and the target to be updated, as well as the Yaml file path as input parameters for the drone plug-in 
 
 Then execute the following similar command 
 
 
 
 
 $ fluxctl release --controller=default:deployment/helloworld --update-image=quay.io/weaveworks/helloworld:master-a000001 
 
 Submitting release ... 
 
 Commit pushed: 33ce4e3 
 
 Applied 33ce4e38048f4b787c583e64505485a13c8a7836 
 
 CONTROLLER                     STATUS   UPDATES 
 
 default:deployment/helloworld  success  helloworld: quay.io/weaveworks/helloworld:master-9a16ff945b9e -> master-a000001 
 
 
 
 
 $ fluxctl list-images --controller default:deployment/helloworld 
 
 CONTROLLER                     CONTAINER   IMAGE                          CREATED 
 
 default:deployment/helloworld  helloworld  quay.io/weaveworks/helloworld 
 
                                           |   master-9a16ff945b9e        20 Jul 16 13:19 UTC 
 
                                           |   master-b31c617a0fe3        20 Jul 16 13:19 UTC 
 
                                           |   master-a000002             12 Jul 16 17:17 UTC 
 
                                           '-> master-a000001             12 Jul 16 17:16 UTC 
 
                               sidecar     quay.io/weaveworks/sidecar 
 
                                           '-> master-a000002             23 Aug 16 10:05 UTC 
 
                                               master-a000001             23 Aug 16 09:53 UTC 
 
 
 
 
 
 
 
 
 
 
 2: Throw away drone for the entire PAAs platform. Flux provides the ability to automatically monitor the registry and Yaml git repositories, as well as to enrich the user's various gameplay. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 3: The next step is to prepare to write the Drone-flux plugin. Gradually realize the idea of this article. Due to the use of spare time, the plugin may not be completed as soon as possible. Also want to be interested, participate in the completion together.