GitOps workloads on infrastructure nodes
Enter a short description here.
Abstract
Chapter 1. Running GitOps control plane workloads on infrastructure nodes Copy linkLink copied to clipboard!
You can use infrastructure nodes to isolate infrastructure workloads for two primary purposes:
- To prevent billing costs associated with the number of subscriptions
- To separate maintenance and management
You can use the OpenShift Container Platform to run GitOps control plane workloads on infrastructure nodes. This includes the Operator pod and the control plane workloads created by the Red Hat OpenShift GitOps Operator in the openshift-gitops namespace by default, including the default Argo CD instance in this namespace.
With GitOps control plane workloads, you can securely and declaratively isolate the infrastructure workloads by creating multiple isolated Argo CD instances in a cluster, with full control over what an Argo CD instance is capable of. In addition, you can manage these Argo CD instances declaratively across multiple developer namespaces. By using taints, you can ensure that only infrastructure components run on these nodes.
All other Argo CD instances installed in user namespaces are not eligible to run on infrastructure nodes.
1.1. Moving GitOps control plane workloads to infrastructure nodes Copy linkLink copied to clipboard!
You can move the GitOps control plane workloads installed by the Red Hat OpenShift GitOps to the infrastructure nodes. The following are the control plane workloads that you can move:
-
kam deployment -
cluster deployment(backend service) -
openshift-gitops-applicationset-controller deployment -
openshift-gitops-dex-server deployment -
openshift-gitops-redis deployment -
openshift-gitops-redis-ha-haproxy deployment -
openshift-gitops-repo-sever deployment -
openshift-gitops-server deployment -
openshift-gitops-application-controller statefulset -
openshift-gitops-redis-server statefulset
Procedure
Label existing nodes as infrastructure by running the following command:
oc label node <node-name> node-role.kubernetes.io/infra=
$ oc label node <node-name> node-role.kubernetes.io/infra=Copy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
GitOpsServicecustom resource (CR) to add the infrastructure node selector:oc edit gitopsservice -n openshift-gitops
$ oc edit gitopsservice -n openshift-gitopsCopy to Clipboard Copied! Toggle word wrap Toggle overflow In the
GitOpsServiceCR file, addrunOnInfrafield to thespecsection and set it totrue. This field moves the control plane workloads inopenshift-gitopsnamespace to the infrastructure nodes:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Apply taints and isolate the workloads on infrastructure nodes and prevent other workloads from scheduling on these nodes.
oc adm taint nodes -l node-role.kubernetes.io/infra
$ oc adm taint nodes -l node-role.kubernetes.io/infra infra=reserved:NoSchedule infra=reserved:NoExecuteCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: If you apply taints to the nodes, you can add tolerations in the
GitOpsServiceCR:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To verify that the workloads are scheduled on infrastructure nodes in the Red Hat OpenShift GitOps namespace, click any of the pod names and ensure that the Node selector and Tolerations have been added.
Any manually added Node selectors and Tolerations in the default Argo CD CR will be overwritten by the toggle and the tolerations in the GitOpsService CR.
1.2. Moving the GitOps Operator pod to infrastructure nodes Copy linkLink copied to clipboard!
You can move the GitOps Operator pod to the infrastructure nodes.
Prerequisites
- You have installed the Red Hat OpenShift GitOps Operator in your cluster.
-
You have access to the cluster with
cluster-adminprivileges.
Procedure
Label an existing node as infrastructure node by running the following command:
oc label node <node_name> node-role.kubernetes.io/infra=
$ oc label node <node_name> node-role.kubernetes.io/infra=1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <node_name> with the name of the node you want to label as infrastructure node.
Example output
node/<node_name> labeled
node/<node_name> labeledCopy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the Red Hat OpenShift GitOps
Subscriptionresource by running the following command:oc -n openshift-gitops-operator edit subscription openshift-gitops-operator
$ oc -n openshift-gitops-operator edit subscription openshift-gitops-operatorCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add
nodeSelectorandtolerationsto thespec.configfield in theSubscriptionresource:Example Subscription
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
subscription.operators.coreos.com/openshift-gitops-operator edited
subscription.operators.coreos.com/openshift-gitops-operator editedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the GitOps Operator pod is running on the infrastructure node by running the following command:
oc -n openshift-gitops-operator get po -owide
$ oc -n openshift-gitops-operator get po -owideCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES openshift-gitops-operator-controller-manager-abcd 2/2 Running 0 11m 94.142.44.126 <node_name> <none> <none>
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES openshift-gitops-operator-controller-manager-abcd 2/2 Running 0 11m 94.142.44.126 <node_name> <none> <none>1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Ensure that the listed
<node_name>is the node with thenode-role.kubernetes.io/infralabel.