Este contenido no está disponible en el idioma seleccionado.
Chapter 6. Automating application management with the GitOps controller
GitOps with Argo CD for MicroShift is a lightweight, optional add-on controller derived from the Red Hat OpenShift GitOps Operator. GitOps for MicroShift uses the command-line interface (CLI) of Argo CD to interact with the GitOps controller that acts as the declarative GitOps engine. You can consistently configure and deploy Kubernetes-based infrastructure and applications across clusters and development lifecycles.
6.1. What you can do with the GitOps agent Copiar enlaceEnlace copiado en el portapapeles!
By using the GitOps with Argo CD agent with MicroShift, you can utilize the following principles:
Implement application lifecycle management.
- Create and manage your clusters and application configuration files using the core principles of developing and maintaining software in a Git repository.
- You can update the single repository and GitOps automates the deployment of new applications or updates to existing ones.
- For example, if you have 1,000 edge devices, each using MicroShift and a local GitOps agent, you can easily add or update an application on all 1,000 devices with just one change in your central Git repository.
- The Git repository contains a declarative description of the infrastructure you need in your specified environment and contains an automated process to make your environment match the described state.
- You can also use the Git repository as an audit trail of changes so that you can create processes based on Git flows such as review and approval for merging pull requests that implement configuration changes.
6.2. Creating GitOps applications on MicroShift Copiar enlaceEnlace copiado en el portapapeles!
You can create a custom YAML configuration to deploy and manage applications in your MicroShift service. To install the necessary packages to run GitOps applications, follow the documentation in "Installing the GitOps Argo CD manifests from an RPM package".
Prerequisites
-
You installed the
microshift-gitopspackages and the Argo CD pods are running in theopenshift-gitopsnamespace.
Procedure
Create a YAML file and add your customized configurations for the application:
Example YAML for a
cert-managerapplicationCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example YAML for a
spring-petclinicapplicationCopy to Clipboard Copied! Toggle word wrap Toggle overflow To deploy the applications defined in the YAML file, run the following command:
oc apply -f <filename>.yaml
$ oc apply -f <filename>.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify your application is deployed and synced, run the following command:
oc get applications -A
$ oc get applications -ACopy to Clipboard Copied! Toggle word wrap Toggle overflow It might take a few minutes for the application to show the
Healthystatus.Example output
NAMESPACE NAME SYNC STATUS HEALTH STATUS openshift-gitops cert-manager Synced Healthy openshift-gitops spring-petclinic Synced Healthy
NAMESPACE NAME SYNC STATUS HEALTH STATUS openshift-gitops cert-manager Synced Healthy openshift-gitops spring-petclinic Synced HealthyCopy to Clipboard Copied! Toggle word wrap Toggle overflow
6.3. Limitations of using the GitOps agent with MicroShift Copiar enlaceEnlace copiado en el portapapeles!
GitOps with Argo CD for MicroShift has the following differences from the Red Hat OpenShift GitOps Operator:
-
The
gitops-operatorcomponent is not used with MicroShift. - To maintain the small resource use of MicroShift, the Argo CD web console is not available. You can use the Argo CD CLI or use a pull-based approach.
- Because MicroShift is single-node, there is no multi-cluster support. Each instance of MicroShift is paired with a local GitOps agent.
-
The
oc adm must-gathercommand is not available in MicroShift.
6.4. Troubleshooting GitOps Copiar enlaceEnlace copiado en el portapapeles!
If you have problems with your GitOps controller, you can use either the OpenShift CLI (oc) tool or run an sos report.
6.4.1. Debugging GitOps with oc adm inspect Copiar enlaceEnlace copiado en el portapapeles!
You can debug GitOps by using the OpenShift CLI (oc).
Prerequisites
-
The
occommand-line tool is installed.
Procedure
Run the
oc adm inspectcommand when in the GitOps namespace:oc adm inspect ns/openshift-gitops
$ oc adm inspect ns/openshift-gitopsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Gathering data for ns/openshift-gitops... W0501 20:34:35.978508 57625 util.go:118] the server doesn't have a resource type egressfirewalls, skipping the inspection W0501 20:34:35.980881 57625 util.go:118] the server doesn't have a resource type egressqoses, skipping the inspection W0501 20:34:36.040664 57625 util.go:118] the server doesn't have a resource type servicemonitors, skipping the inspection Wrote inspect data to inspect.local.2673575938140296280.
Gathering data for ns/openshift-gitops... W0501 20:34:35.978508 57625 util.go:118] the server doesn't have a resource type egressfirewalls, skipping the inspection W0501 20:34:35.980881 57625 util.go:118] the server doesn't have a resource type egressqoses, skipping the inspection W0501 20:34:36.040664 57625 util.go:118] the server doesn't have a resource type servicemonitors, skipping the inspection Wrote inspect data to inspect.local.2673575938140296280.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Next steps
-
If
oc adm inspectdid not provide the information you need, you can run an sos report.
6.4.2. Gathering data from an sos report Copiar enlaceEnlace copiado en el portapapeles!
Prerequisites
-
You must have the
sospackage installed.
Procedure
- Log into the failing host as a root user.
Perform the debug report creation procedure by running the following command:
microshift-sos-report
$ microshift-sos-reportCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow