author ：Kostis Kapelonis
Argo CD（Argo Part of the project ） One is for Kubernetes And the deployment solution , follow GitOps Pattern .
Use Argo CD Deploy to Kubernetes
In the most basic scenario ,Argo CD Use Kubernetes List continuous monitoring Git Warehouse （ Also support Helm and Kustomize） And listen to submit Events .
When a submission occurs （ It is usually a commit that updates the version of the mirror artifact ） when ,Argo CD Will start a “ Sync （synchronization）” process , This process is responsible for making the cluster configuration in the Git The same state described in .
When the synchronization process is complete , We know that application configuration and Git The list is exactly the same .
Argo CD The deployment process of GitOps The core idea behind it ：
- All application configurations are stored in Git in （ Usually in a different repository than the source code ）
- Deploy in a way that “ PULL ” In a way that , Cluster from Git Get the list （ Instead of updating “ PUSH ” Traditional solutions to clustering ）.
- Deployment is a process of coordination between two states （Git The state described in and the state of deployment in the cluster ）
Although the synchronization process is critical to performing the initial deployment of an application , but Argo CD One of the real advantages is the ability to continuously monitor both States after deployment is complete （ Clusters and Git）. This continuous monitoring is very important for resolving configuration drift , Configuration drift is a very common problem in organizations with a large number of deployment targets .
Different Kubernetes Configuration drift between clusters
Configuration drift is a problem even in traditional virtual machines , And as early as Kubernetes Before appearance , It's been bothering production deployment . When CI/CD Failed to deploy to multiple platforms , The problem will come out , Because a set of machines that should be similar are actually configured differently .
In some organizations , Developers use “ On the stage （staging）” Environment to test its application . Ideally , The staging environment should match the configuration of the production environment , This allows developers to be confident that any tests they perform on the stage will match closely with the production environment .
Especially in Kubernetes In the cluster , Teams often use special commands （ for example , adopt kubectl） In a completely different place CI/CD Perform changes on the cluster outside the process .
These particular changes are a major problem with application deployment . Configuration differences are one of the most common reasons for deployment failures . Applications that have successfully passed all tests in a staging environment will have an interrupt state in production , Because the required settings are not provided or in the expected format .
Another hidden problem caused by configuration drift is , Gradually lost in the machine / Knowledge of what was deployed on the node and the exact time of the last change .Argo CD That solved the problem , It will Git As the real source of current and all past deployments .
After a deployment failure , Operators and developers try to understand the cause of the accident , The first question they asked was “ What was the last change in this cluster ”. If the cluster is in the approved CI/CD An uncontrolled change occurred outside of the process , So it's hard to answer this question .
Argo CD How to detect configuration drift
Argo CD A completely different approach to deployment （“pull from Git” normal form ）. Because all deployment can be traced back to Git Submit , therefore Git The commit history is also the cluster deployment history .
Developers can use what they like Git Tools to answer questions such as “ What was deployed on the cluster last Thursday ？” perhaps “ What happened between Monday and Thursday this week ？”
Let's assume that one person in the team completely bypasses Argo CD, And use kubectl Make manual changes directly to the cluster . other CI/CD The solution will completely ignore this change , This provides an environment for the configuration drift problem .
Argo CD Will understand the changes in the cluster , These two states （ Cluster configuration and Git detailed list ） It's not the same anymore . The deployment will be immediately marked as “ Out of sync （out-of-sync）”.
Argo CD It's going to dig deeper , It even provides a good overview of the differences , What has changed ：
In the example above ,Argo CD Cluster and cluster detected Git The port configuration of services between is no longer the same .
When you detect this difference , You can manually put the application in contact with Git The same state （ Perform the synchronization process again ）, Or instructions Argo CD Automatically synchronize itself when a configuration change is detected .
It means Argo CD Configuration drift （ At least Kubernetes For applications ） Completely eliminated , Especially if the automatic synchronization behavior is enabled .
Use Argo CD The team can deploy with confidence , Because they know the cluster is in the state it should be in （ The status is in Git The complete description is also in the list ）. Configuration drift is no longer a problem , Keeping the staging and production process as close as possible is a very simple process .
Argo And Devops The combination of platforms
except Argo CD The main project of , You may also find that Argo Rollouts The project is very interesting .Argo Rollouts yes Argo Another project of , Used to deal with Kubernetes Step by step （ blue / green / Grayscale ） Deploy .
Argo CD and Argo Rollouts It's great for dealing with application deployment , But they need to be combined with a complete automation solution , This solution will also address all other aspects of the software lifecycle , For example, application building 、 unit testing 、 Secret management and pull request processing .
Argo CD Very suitable for actual deployment , But it assumes that the artifact has already been created by another solution . That's why we've been trying to make Codefresh and Argo Integrate together , To cover the entire software life cycle , Even override automatically pushes changes to Argo monitor manifest Of Git The scene of the warehouse （ That is to perform automatic submission , To practice continuous deployment ）.
Learn more , Please visit Argo The main website of .
Kostis Kapelonis yes Codefresh The developer advocate for ,Codefresh One is for Kubernetes And container built continuous delivery platform .Kostis I used to be a software engineer , Has many years of application container 、 structure CI/CD Assembly line and development Java Application experience . He lives in Greece , I like roller skating .
CNCF (Cloud Native Computing Foundation) Founded on 2015 year 12 month , Affiliated to the Linux Foundation, It's a non-profit organization .
CNCF（ Cloud native Computing Foundation ） Committed to fostering and maintaining a vendor neutral open source ecosystem , To promote cloud native technology . By democratizing the most cutting-edge model , Let these innovations be used by the public . Please press the following QR code for attention .
This article is from WeChat official account. - CNCF（lf_cncf） , author ：CNCF
The source and reprint of the original text are detailed in the text , If there is any infringement , Please contact the email@example.com Delete .
Original publication time ： 2020-12-23
Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .