Automated state control in Argo CD
- [Instructor] To demonstrate the final GitOps principle, automated state control, we're going to violate one of the golden rules of GitOps, yup, I'm going to use kubectl to directly modify the Kubernetes cluster. Don't try this in prod. All right, so let's take a look at what's running on the cluster. To do that, just click on a pod and you'll see that we're running version 2.0 of the container image. that's the desired state, that's what's in Git. Now let's create some drift. To do that, I'm going to navigate to a terminal and inside of this terminal, we're going to issue a patch command using kubectl. So this command is going to roll back the image in the deployment to the first version of our container image. So we're purposely creating some drift so that our cluster's runtime state doesn't match the desired state in Git. All right, let's go ahead, let's issue that command and then take a look at Argo CD. You'll notice it automatically picks up that the cluster is out of sync with the desired state in Git. And if we want to learn more about the drift, we can click on the app diff button, and then here we can select Compact Diff and it's going to point out the exact cause of the drift. So it shows us the difference between our desired state and our cluster's runtime state, and you can see it's pinpointing that container image. Now, if we navigate into the app details, here if we scroll down, you'll notice that the self-heal policy hasn't been enabled and I did that purposefully so that we could pause and take a look at that drift that gets created when we run an imperative command via kubectl. If we go ahead and enable this option for self healing, take a look at what the cluster does, it automatically begins to reconcile the cluster's runtime state with the desired state in Git. So if we take a look here when it finishes, you'll notice we're back to version 2.0 of that container image. And let's see what happens if I issue the patch command again. So here, if we take a look, the cluster stayed reconciled, it corrected the drift rather quickly. We didn't even see it, but if we take a look at one of the pods, you can see that we're running version 2.0 of the container image. So that's the control loop in action, it reconciled the system's runtime state with the desired state to get things restored. That's automated state control, our final GitOps principle in action.
内容
-
-
-
-
(已锁定)
GitOps principles1 分钟 29 秒
-
(已锁定)
Declarative configuration3 分钟 49 秒
-
(已锁定)
Git as the source of truth2 分钟 27 秒
-
(已锁定)
Automated change delivery2 分钟 8 秒
-
(已锁定)
Automated state control2 分钟 4 秒
-
(已锁定)
Desired state in Argo CD3 分钟 57 秒
-
(已锁定)
Automated change delivery in Argo CD6 分钟 25 秒
-
Automated state control in Argo CD2 分钟 55 秒
-
(已锁定)
-
-
-