zoukankan      html  css  js  c++  java
  • GITOps a way of implementing Continuous Deployment for cloud native applications

    GITOps

    https://www.gitops.tech/

    实现云原生应用自动化部署的方法

    在运维基础设施时候,聚焦在开发行者中心的体验上, 使用开发者熟悉的工具, 例如git和其它持续发布工具。

    GitOps is a way of implementing Continuous Deployment for cloud native applications. It focuses on a developer-centric experience when operating infrastructure, by using tools developers are already familiar with, including Git and Continuous Deployment tools.

    The core idea of GitOps is having a Git repository that always contains declarative descriptions of the infrastructure currently desired in the production environment and an automated process to make the production environment match the described state in the repository. If you want to deploy a new application or update an existing one, you only need to update the repository - the automated process handles everything else. It’s like having cruise control for managing your applications in production.

    WHY?

    优点:

    更加频繁地快速部署 -- 部署过程自动化

    容易和快速错误恢复 -- 遇到问题,快速恢复

    更加私密的环境管理方法, 开发者不需要直接访问环境

    自备文档的部署 -- 代码即文档,需要登录服务器查看部署状态

    便于知识传递。

    Deploy Faster More Often

    Okay, to be fair, probably every Continuous Deployment technology promises to make deploying faster and allows you to deploy more often. What is unique about GitOps is that you don’t have to switch tools for deploying your application. Everything happens in the version control system you use for developing the application anyways.

    When we say “high velocity” we mean that every product team can safely ship updates many times a day — deploy instantly, observe the results in real time, and use this feedback to roll forward or back.

    Weaveworks

    Easy and Fast Error Recovery

    Oh no! Your production environment is down! With GitOps you have a complete history of how your environment changed over time. This makes error recovery as easy as issuing a git revert and watching your environment being restored.

    The Git record is then not just an audit log but also a transaction log. You can roll back & forth to any snapshot.

    Alexis Richardson

    Easier Credential Management

    GitOps allows you to manage deployments completely from inside your environment. For that, your environment only needs access to your repository and image registry. That’s it. You don’t have to give your developers direct access to the environment.

    kubectl is the new ssh. Limit access and only use it for deployments when better tooling is not available.

    Kelsey Hightower

    Self-documenting Deployments

    Have you ever SSH’d into a server and wondered what’s running there? With GitOps, every change to any environment must happen through the repository. You can always check out the master branch and get a complete description of what is deployed where plus the complete history of every change ever made to the system. And you get an audit trail of any changes in your system for free!

    Shared Knowledge in Teams

    Using Git to store complete descriptions of your deployed infrastructure allows everybody in your team to check out its evolution over time. With great commit messages everybody can reproduce the thought process of changing infrastructure and also easily find examples of how to set up new systems.

    GitOps is the best thing since configuration as code. Git changed how we collaborate, but declarative configuration is the key to dealing with infrastructure at scale, and sets the stage for the next generation of management tools.

    HOW?

    除了常规的 应用 代码仓库

    我们还需要一个 环境配置 仓库, 专门用于存储 Infrastructure Code

    How does GitOps work?

    Environment Configurations as Git repository

    GitOps organizes the deployment process around code repositories as the central element. There are at least two repositories: the application repository and the environment configuration repository. The application repository contains the source code of the application and the deployment manifests to deploy the application. The environment configuration repository contains all deployment manifests of the currently desired infrastructure of an deployment environment. It describes what applications and infrastructural services (message broker, service mesh, monitoring tool, …) should run with what configuration and version in the deployment environment.

    push -based

    应用代码库变更, 触发构建流水线, 发布新的容器镜像, 并跟新 环境配置 库,

    环境配置库的变更, 触发部署流水线, 将新的环境配置更新到环境中。

    需要自建立监控系统, 检测部署内容是否 和 环境配置 库中内容保持一致。

    Push-based Deployments

    The Push-based deployment strategy is implemented by popular CI/CD tools such as Jenkins, CircleCI, or Travis CI. The source code of the application lives inside the application repository along with the Kubernetes YAMLs needed to deploy the app. Whenever the application code is updated, the build pipeline is triggered, which builds the container images and finally the environment configuration repository is updated with new deployment descriptors.

    Tip: You can also just store templates of the YAMLs in the application repository. When a new version is built, the template can be used to generate the YAML in the environment configuration repository.

    Push-based Deployments

    Changes to the environment configuration repository trigger the deployment pipeline. This pipeline is responsible for applying all manifests in the environment configuration repository to the infrastructure. With this approach it is indispensable to provide credentials to the deployment environment. So the pipeline has god-mode enabled. In some use cases a Push-based deployment is inevitable when running an automated provisioning of cloud infrastructure. In such cases it is strongly recommended to utilize the fine-granular configurable authorization system of the cloud provider for more restrictive deployment permissions.

    Another important thing to keep in mind when using this approach is that the deployment pipeline only is triggered when the environment repository changes. It can not automatically notice any deviations of the environment and its desired state. This means, it needs some way of monitoring in place, so that one can intervene if the environment doesn’t match what is described in the environment repository.

    pull-based

    应用代码库变更, 触发构建流水线, 发布新的容器镜像, 并跟新 环境配置 库,

    部署部分, 由操作器 收集当前环境信息, 并 监控环境配置库的变动, 如果有变动则执行配置更新操作。

    Pull-based Deployments

    The Pull-based deployment strategy uses the same concepts as the push-based variant but differs in how the deployment pipeline works. Traditional CI/CD pipelines are triggered by an external event, for example when new code is pushed to an application repository. With the pull-based deployment approach, the operator is introduced. It takes over the role of the pipeline by continuously comparing the desired state in the environment repository with the actual state in the deployed infrastructure. Whenever differences are noticed, the operator updates the infrastructure to match the environment repository. Additionally the image registry can be monitored to find new versions of images to deploy.

    Pull-based Deployments

    Just like the push-based deployment, this variant updates the environment whenever the environment repository changes. However, with the operator, changes can also be noticed in the other direction. Whenever the deployed infrastructure changes in any way not described in the environment repository, these changes are reverted. This ensures that all changes are made traceable in the Git log, by making all direct changes to the cluster impossible.

    This change in direction solves the problem of push-based deployments, where the environment is only updated when the environment repository is updated. However, this doesn’t mean you can completely do without any monitoring in place. Most operators support sending mails or Slack notifications if it can not bring the environment to the desired state for any reason, for example if it can not pull a container image. Additionally, you probably should set up monitoring for the operator itself, as there is no longer any automated deployment process without it.

    The operator should always live in the same environment or cluster as the application to deploy. This prevents the god-mode, seen with the push-based approach, where credentials for doing deployments are known by the CI/CD pipeline. When the actual deploying instance lives inside the very same environment, no credentials need to be known by external services. The Authorization mechanism of the deployment platform in use can be utilized to restrict the permissions on performing deployments. This has a huge impact in terms of security. When using Kubernetes, RBAC configurations and service accounts can be utilized.

    DEVOPS vs GITOPS

    DEVOPS是关于组织文化的变化。

    GITOPS是实现CD的技术思想。

    两者共享相同的原则: 自动化 和 自服务型基础设施。

    We are already doing DevOps. What’s the difference to GitOps?

    DevOps is all about the cultural change in an organization to make people work better together. GitOps is a technique to implement Continuous Delivery. While DevOps and GitOps share principles like automation and self-serviced infrastructure, it doesn’t really make sense to compare them. However, these shared principles certainly make it easier to adopt a GitOps workflow when you are already actively employing DevOps techniques.

    TOOLS

    https://dzone.com/articles/30-tools-list-for-gitops

    出处:http://www.cnblogs.com/lightsong/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
  • 相关阅读:
    2018-2019-1 20165308 5317 5331 实验三 实时系统
    daima
    2018-2019-1 20165308 20165317 20165331 实验二 固件程序设计
    2018-2019-1 20165308 20165317 20165331 实验一 开发环境的熟悉
    2018 第三周 20165308 缓冲区溢出漏洞实验
    20165308 信息安全系统设计基础 第一周总结
    20165308 2017-2018-2 《Java程序设计》课程总结
    2017-2018-2 20165308 实验五《网络编程与安全》实验报告
    2018-2019-2 20165320 《网络对抗技术》 Exp6 信息搜集与漏洞扫描
    2018-2019-2 网络对抗技术 20165320 Exp5 MSF基础应用
  • 原文地址:https://www.cnblogs.com/lightsong/p/15745234.html
Copyright © 2011-2022 走看看