Learn how to use GitOps practices on OpenShift to deploy an application on multiple clusters, configure the application for each cluster, then perform a canary deployment of a new application version.
- GitOps practices from the Introduction to GitOps on OpenShift
- ArgoCD continuous deployment server
- Employing two or more OpenShift clusters
- OpenShift Projects and Applications
You can establish an automated GitOps process to deploy and maintain versioned source, container images, and resource specs for an application, with specific variations for each cluster that runs it. For example, you can divide development and production deployments between two OpenShift installations.
These OpenShift clusters will self-destruct in one hour.
Congratulations! You just finished learning the basics on Multi-cluster GitOps with OpenShift. Feels good doesn't it?
We also have the federation-dev repository with demos, labs and examples around GitOps.
At this point you are probably itching to keep working with OpenShift as you have had a glimpse of the power this can bring to your own applications. We are currently working on more advanced tutorials that will be hosted here but in the meantime, you can certainly run your own version of OpenShift or use a hosted model. You are welcome to use one of the following options:
Minishift is a complete OpenShift environment which you can run on your local machine. The project supports Windows, OS X, and the Linux operating system. To find more about minishift, visit http://www.openshift.org/vm
oc cluster up
oc cluster up is a command provided by the
oc client tool. It configures and runs an openshift environment inside of the native docker system for your operating system. It supports Windows, OS X, and the Linux operating systems. For more information, visit https://docs.okd.io/latest/getting_started/administrators.html
If you decide to try out oc cluster up, and you should, I would also suggest that you take a look at a wrapper script that was created to make life a little bit easier for you called oc cluster wrapper. This wrapper provides functionality such as the ability to have different profiles, persistent volume management and other great features. You can find more information at the official git repository at https://github.com/openshift-evangelists/oc-cluster-wrapper
The OpenShift team provides a hosted environment which includes a free starter plan which you can use to develop and test applications for OpenShift. You can find details for OpenShift Online and sign up at https://www.openshift.com/pricing/index.html
You can also let Red Hat host an OpenShift instance for you on a public cloud. This is an ideal scenario for larger teams that do not want to deal with the operational aspects of running a full environment. To find out more, visit https://www.openshift.com/dedicated/
Multi-cluster GitOps with OpenShift
Step 1 - Argo CD Introduction
What is Argo CD?
Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.
How it works
Argo CD follows the GitOps pattern, a Git repository will be used as the source of truth for the definition of our applications.
Our applications will be defined using Kubernetes manifests in several ways:
- Kustomize Applications
- Helm Charts
- Ksonnet Applications
- Jsonnet Files
- Plain directory of YAML/JSON Manifests
- Any custom config management tool configured as a config management plugin
NOTE: In this lab we are going to use plain directories and yaml files to define our application.
Argo CD Under the Hood
Argo CD is implemented as a Kubernetes Controller which compares the desired application state defined in Git against the current, live state in Kubernetes.
In case there is a deviation from the state defined in Git, Argo CD will move the live state towards the desired state in Git. The remediation will be automatically or manual depending on the application configuration.